home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 10 / BBS In A Box Volume X (AMUG) (January 1994).bin / Files / Prog / U-Z / VideoToolBox.cpt / VideoToolboxSources / VBLInstall.c < prev    next >
MacBinary  |  1993-03-09  |  12.4 KB  |  [TEXT/KAHL]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Tue Mar 9 21:33:28 1993, modified Tue Mar 9 21:33:28 1993, creator Think C, type ASCII, 11984 bytes "VBLInstall.c" , at 0x2f50 480 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[KAHL]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0c 56 42 4c 49 6e 73 | 74 61 6c 6c 2e 63 00 00 |..VBLIns|tall.c..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 01 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 2e d0 00 | 00 01 e0 a7 c3 03 f8 a7 |........|........|
|00000060| c3 03 f8 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 77 81 00 00 |........|....w...|
|00000080| 2f 2a 0d 56 42 4c 49 6e | 73 74 61 6c 6c 2e 63 0d |/*.VBLIn|stall.c.|
|00000090| 0d 54 68 69 73 20 69 73 | 20 74 68 65 20 41 70 70 |.This is| the App|
|000000a0| 6c 65 2d 72 65 63 6f 6d | 6d 65 6e 64 65 64 20 77 |le-recom|mended w|
|000000b0| 61 79 20 6f 66 20 73 79 | 6e 63 68 72 6f 6e 69 7a |ay of sy|nchroniz|
|000000c0| 69 6e 67 20 79 6f 75 72 | 20 70 72 6f 67 72 61 6d |ing your| program|
|000000d0| 20 74 6f 20 61 20 76 69 | 64 65 6f 0d 64 69 73 70 | to a vi|deo.disp|
|000000e0| 6c 61 79 2e 20 49 6e 20 | 74 68 65 20 4d 61 63 69 |lay. In |the Maci|
|000000f0| 6e 74 6f 73 68 2c 20 69 | 6e 74 65 72 72 75 70 74 |ntosh, i|nterrupt|
|00000100| 20 73 65 72 76 69 63 65 | 20 72 6f 75 74 69 6e 65 | service| routine|
|00000110| 73 20 72 75 6e 20 61 74 | 20 61 20 68 69 67 68 20 |s run at| a high |
|00000120| 70 72 6f 63 65 73 73 6f | 72 0d 70 72 69 6f 72 69 |processo|r.priori|
|00000130| 74 79 2c 20 69 2e 65 2e | 20 74 68 65 79 20 62 6c |ty, i.e.| they bl|
|00000140| 6f 63 6b 20 69 6e 74 65 | 72 72 75 70 74 73 20 77 |ock inte|rrupts w|
|00000150| 68 69 6c 65 20 74 68 65 | 79 20 72 75 6e 2c 20 73 |hile the|y run, s|
|00000160| 6f 20 41 70 70 6c 65 20 | 61 64 76 69 73 65 73 20 |o Apple |advises |
|00000170| 74 68 61 74 20 74 68 65 | 79 0d 62 65 20 76 65 72 |that the|y.be ver|
|00000180| 79 20 71 75 69 63 6b 2c | 20 74 6f 20 61 76 6f 69 |y quick,| to avoi|
|00000190| 64 20 6d 69 73 73 69 6e | 67 20 69 6e 74 65 72 72 |d missin|g interr|
|000001a0| 75 70 74 73 2e 20 54 68 | 61 74 20 69 73 20 74 68 |upts. Th|at is th|
|000001b0| 65 20 61 70 70 72 6f 61 | 63 68 20 74 61 6b 65 6e |e approa|ch taken|
|000001c0| 20 68 65 72 65 2c 0d 75 | 73 69 6e 67 20 74 68 65 | here,.u|sing the|
|000001d0| 20 69 6e 74 65 72 72 75 | 70 74 20 73 65 72 76 69 | interru|pt servi|
|000001e0| 63 65 20 72 6f 75 74 69 | 6e 65 73 20 73 6f 6c 65 |ce routi|nes sole|
|000001f0| 6c 79 20 74 6f 20 62 75 | 6d 70 20 61 20 66 72 61 |ly to bu|mp a fra|
|00000200| 6d 65 20 63 6f 75 6e 74 | 65 72 20 61 6e 64 20 73 |me count|er and s|
|00000210| 65 74 20 61 0d 6e 65 77 | 46 72 61 6d 65 20 66 6c |et a.new|Frame fl|
|00000220| 61 67 20 74 6f 20 74 72 | 75 65 2e 20 54 79 70 69 |ag to tr|ue. Typi|
|00000230| 63 61 6c 6c 79 20 79 6f | 75 72 20 6d 61 69 6e 20 |cally yo|ur main |
|00000240| 70 72 6f 67 72 61 6d 20 | 77 69 6c 6c 20 69 74 65 |program |will ite|
|00000250| 72 61 74 69 76 65 6c 79 | 20 74 65 73 74 20 74 68 |ratively| test th|
|00000260| 65 0d 6e 65 77 46 72 61 | 6d 65 20 66 6c 61 67 20 |e.newFra|me flag |
|00000270| 61 6e 64 2c 20 77 68 65 | 6e 20 69 74 27 73 20 74 |and, whe|n it's t|
|00000280| 72 75 65 2c 20 63 6c 65 | 61 72 20 69 74 20 61 6e |rue, cle|ar it an|
|00000290| 64 20 64 6f 20 73 6f 6d | 65 20 61 63 74 69 6f 6e |d do som|e action|
|000002a0| 20 74 68 61 74 20 79 6f | 75 20 77 61 6e 74 20 74 | that yo|u want t|
|000002b0| 6f 0d 64 6f 20 6f 6e 63 | 65 20 70 65 72 20 66 72 |o.do onc|e per fr|
|000002c0| 61 6d 65 2c 20 69 6e 20 | 73 79 6e 63 68 20 77 69 |ame, in |synch wi|
|000002d0| 74 68 20 74 68 65 20 76 | 69 64 65 6f 20 66 72 61 |th the v|ideo fra|
|000002e0| 6d 65 73 2e 0d 0d 4f 53 | 45 72 72 20 56 42 4c 49 |mes...OS|Err VBLI|
|000002f0| 6e 73 74 61 6c 6c 28 56 | 42 4c 54 61 73 6b 41 6e |nstall(V|BLTaskAn|
|00000300| 64 41 35 20 2a 76 62 6c | 44 61 74 61 2c 47 44 48 |dA5 *vbl|Data,GDH|
|00000310| 61 6e 64 6c 65 20 64 65 | 76 69 63 65 2c 69 6e 74 |andle de|vice,int|
|00000320| 20 66 72 61 6d 65 73 29 | 0d 0d 54 68 65 20 66 69 | frames)|..The fi|
|00000330| 72 73 74 20 61 72 67 75 | 6d 65 6e 74 20 69 73 20 |rst argu|ment is |
|00000340| 61 20 70 6f 69 6e 74 65 | 72 20 74 6f 20 61 20 75 |a pointe|r to a u|
|00000350| 73 65 72 2d 73 75 70 70 | 6c 69 65 64 20 64 61 74 |ser-supp|lied dat|
|00000360| 61 20 73 74 72 75 63 74 | 75 72 65 2e 20 22 64 65 |a struct|ure. "de|
|00000370| 76 69 63 65 22 20 69 73 | 20 61 0d 68 61 6e 64 6c |vice" is| a.handl|
|00000380| 65 20 74 6f 20 76 69 64 | 65 6f 20 73 63 72 65 65 |e to vid|eo scree|
|00000390| 6e 20 74 68 61 74 20 79 | 6f 75 20 77 61 6e 74 20 |n that y|ou want |
|000003a0| 74 6f 20 73 79 6e 63 68 | 72 6f 6e 69 7a 65 20 74 |to synch|ronize t|
|000003b0| 6f 2c 20 6f 72 20 4e 55 | 4c 4c 20 69 66 20 79 6f |o, or NU|LL if yo|
|000003c0| 75 20 77 61 6e 74 20 74 | 6f 0d 73 79 6e 63 68 72 |u want t|o.synchr|
|000003d0| 6f 6e 69 7a 65 20 74 6f | 20 74 68 65 20 53 79 73 |onize to| the Sys|
|000003e0| 74 65 6d 20 56 42 4c 20 | 72 61 74 65 20 28 75 73 |tem VBL |rate (us|
|000003f0| 75 61 6c 6c 79 20 36 30 | 2e 31 35 20 48 7a 29 2e |ually 60|.15 Hz).|
|00000400| 20 54 68 65 20 6c 61 73 | 74 20 61 72 67 75 6d 65 | The las|t argume|
|00000410| 6e 74 0d 73 70 65 63 69 | 66 69 65 73 20 68 6f 77 |nt.speci|fies how|
|00000420| 20 6d 61 6e 79 20 74 69 | 6d 65 73 20 22 66 72 61 | many ti|mes "fra|
|00000430| 6d 65 73 22 20 79 6f 75 | 20 77 61 6e 74 20 74 68 |mes" you| want th|
|00000440| 65 20 69 6e 74 65 72 72 | 75 70 74 20 74 6f 20 6f |e interr|upt to o|
|00000450| 63 63 75 72 2e 0d 0d 48 | 65 72 65 27 73 20 61 20 |ccur...H|ere's a |
|00000460| 6d 69 6e 69 6d 61 6c 20 | 70 72 6f 67 72 61 6d 2c |minimal |program,|
|00000470| 20 65 78 74 72 61 63 74 | 65 64 20 66 72 6f 6d 20 | extract|ed from |
|00000480| 4e 6f 69 73 65 56 42 4c | 2e 63 2c 20 74 68 61 74 |NoiseVBL|.c, that|
|00000490| 20 75 73 65 73 20 74 68 | 65 73 65 20 72 6f 75 74 | uses th|ese rout|
|000004a0| 69 6e 65 73 20 74 6f 0d | 73 68 6f 77 20 61 20 6d |ines to.|show a m|
|000004b0| 6f 76 69 65 2c 20 77 69 | 74 68 20 61 20 6e 65 77 |ovie, wi|th a new|
|000004c0| 20 69 6d 61 67 65 20 6f | 6e 20 65 61 63 68 20 76 | image o|n each v|
|000004d0| 69 64 65 6f 20 66 72 61 | 6d 65 3a 0d 0d 09 56 42 |ideo fra|me:...VB|
|000004e0| 4c 54 61 73 6b 41 6e 64 | 41 35 20 6e 6f 69 73 65 |LTaskAnd|A5 noise|
|000004f0| 56 42 4c 3b 0d 09 47 44 | 48 61 6e 64 6c 65 20 64 |VBL;..GD|Handle d|
|00000500| 65 76 69 63 65 3d 47 65 | 74 4d 61 69 6e 44 65 76 |evice=Ge|tMainDev|
|00000510| 69 63 65 28 29 3b 0d 09 | 69 6e 74 20 66 72 61 6d |ice();..|int fram|
|00000520| 65 73 3d 31 30 30 2c 65 | 72 72 6f 72 3b 0d 0d 09 |es=100,e|rror;...|
|00000530| 6e 6f 69 73 65 56 42 4c | 2e 73 75 62 72 6f 75 74 |noiseVBL|.subrout|
|00000540| 69 6e 65 3d 4e 55 4c 4c | 3b 09 09 09 09 2f 2f 20 |ine=NULL|;....// |
|00000550| 72 65 71 75 65 73 74 20 | 64 65 66 61 75 6c 74 20 |request |default |
|00000560| 73 75 62 72 6f 75 74 69 | 6e 65 0d 09 65 72 72 6f |subrouti|ne..erro|
|00000570| 72 3d 56 42 4c 49 6e 73 | 74 61 6c 6c 28 26 6e 6f |r=VBLIns|tall(&no|
|00000580| 69 73 65 56 42 4c 2c 64 | 65 76 69 63 65 2c 66 72 |iseVBL,d|evice,fr|
|00000590| 61 6d 65 73 29 3b 0d 09 | 69 66 28 65 72 72 6f 72 |ames);..|if(error|
|000005a0| 29 50 72 69 6e 74 66 45 | 78 69 74 28 22 56 42 4c |)PrintfE|xit("VBL|
|000005b0| 49 6e 73 74 61 6c 6c 20 | 65 72 72 6f 72 20 25 64 |Install |error %d|
|000005c0| 5c 6e 22 2c 65 72 72 6f | 72 29 3b 0d 09 6e 6f 69 |\n",erro|r);..noi|
|000005d0| 73 65 56 42 4c 2e 76 62 | 6c 2e 76 62 6c 43 6f 75 |seVBL.vb|l.vblCou|
|000005e0| 6e 74 3d 31 3b 09 2f 2f | 20 65 6e 61 62 6c 65 20 |nt=1;.//| enable |
|000005f0| 74 68 65 20 69 6e 74 65 | 72 72 75 70 74 20 73 65 |the inte|rrupt se|
|00000600| 72 76 69 63 65 20 72 6f | 75 74 69 6e 65 0d 09 77 |rvice ro|utine..w|
|00000610| 68 69 6c 65 28 6e 6f 69 | 73 65 56 42 4c 2e 66 72 |hile(noi|seVBL.fr|
|00000620| 61 6d 65 73 4c 65 66 74 | 29 7b 0d 09 09 69 66 28 |amesLeft|){...if(|
|00000630| 6e 6f 69 73 65 56 42 4c | 2e 6e 65 77 46 72 61 6d |noiseVBL|.newFram|
|00000640| 65 29 7b 0d 09 09 09 6e | 6f 69 73 65 56 42 4c 2e |e){....n|oiseVBL.|
|00000650| 6e 65 77 46 72 61 6d 65 | 3d 30 3b 0d 09 09 09 43 |newFrame|=0;....C|
|00000660| 6f 70 79 42 69 74 73 51 | 75 69 63 6b 6c 79 28 28 |opyBitsQ|uickly((|
|00000670| 42 69 74 4d 61 70 20 2a | 29 26 28 6d 6f 76 69 65 |BitMap *|)&(movie|
|00000680| 5b 6e 6f 69 73 65 56 42 | 4c 2e 66 72 61 6d 65 73 |[noiseVB|L.frames|
|00000690| 4c 65 66 74 5d 29 0d 09 | 09 09 09 2c 28 42 69 74 |Left])..|...,(Bit|
|000006a0| 4d 61 70 20 2a 29 2a 28 | 28 43 47 72 61 66 50 74 |Map *)*(|(CGrafPt|
|000006b0| 72 29 77 69 6e 64 6f 77 | 29 2d 3e 70 6f 72 74 50 |r)window|)->portP|
|000006c0| 69 78 4d 61 70 0d 09 09 | 09 09 2c 26 6e 6f 69 73 |ixMap...|..,&nois|
|000006d0| 65 49 6d 61 67 65 5b 30 | 5d 2e 62 6f 75 6e 64 73 |eImage[0|].bounds|
|000006e0| 2c 26 77 69 6e 64 6f 77 | 2d 3e 70 6f 72 74 52 65 |,&window|->portRe|
|000006f0| 63 74 2c 73 72 63 43 6f | 70 79 2c 4e 55 4c 4c 29 |ct,srcCo|py,NULL)|
|00000700| 3b 0d 09 09 7d 0d 09 7d | 0d 09 56 42 4c 52 65 6d |;...}..}|..VBLRem|
|00000710| 6f 76 65 28 26 6e 6f 69 | 73 65 56 42 4c 29 3b 0d |ove(&noi|seVBL);.|
|00000720| 0d 41 70 70 6c 65 20 77 | 61 72 6e 73 20 74 68 61 |.Apple w|arns tha|
|00000730| 74 20 69 6e 74 65 72 72 | 75 70 74 20 73 65 72 76 |t interr|upt serv|
|00000740| 69 63 65 20 72 6f 75 74 | 69 6e 65 73 20 61 6e 64 |ice rout|ines and|
|00000750| 20 61 6e 79 20 64 61 74 | 61 20 74 68 61 74 20 74 | any dat|a that t|
|00000760| 68 65 79 20 61 63 63 65 | 73 73 20 6d 75 73 74 0d |hey acce|ss must.|
|00000770| 62 65 20 6c 6f 63 6b 65 | 64 20 69 6e 74 6f 20 6d |be locke|d into m|
|00000780| 65 6d 6f 72 79 2c 20 6e | 6f 74 20 73 77 61 70 70 |emory, n|ot swapp|
|00000790| 65 64 20 6f 75 74 2c 20 | 65 2e 67 2e 20 64 75 65 |ed out, |e.g. due|
|000007a0| 20 74 6f 20 6f 70 65 72 | 61 74 69 6f 6e 20 6f 66 | to oper|ation of|
|000007b0| 20 74 68 65 20 4d 65 6d | 6f 72 79 0d 4d 61 6e 61 | the Mem|ory.Mana|
|000007c0| 67 65 72 20 6f 72 20 56 | 69 72 74 75 61 6c 20 4d |ger or V|irtual M|
|000007d0| 65 6d 6f 72 79 2e 20 49 | 74 20 69 73 20 64 61 6e |emory. I|t is dan|
|000007e0| 67 65 72 6f 75 73 20 74 | 6f 20 61 6c 6c 6f 77 20 |gerous t|o allow |
|000007f0| 79 6f 75 72 20 63 6f 6d | 70 69 6c 65 72 20 74 6f |your com|piler to|
|00000800| 20 69 6e 73 74 61 6c 6c | 0d 64 65 62 75 67 67 69 | install|.debuggi|
|00000810| 6e 67 20 63 6f 64 65 20 | 69 6e 74 6f 20 69 6e 74 |ng code |into int|
|00000820| 65 72 72 75 70 74 20 73 | 65 72 76 69 63 65 20 72 |errupt s|ervice r|
|00000830| 6f 75 74 69 6e 65 73 2e | 20 49 74 20 69 73 20 56 |outines.| It is V|
|00000840| 45 52 59 20 69 6d 70 6f | 72 74 61 6e 74 20 74 68 |ERY impo|rtant th|
|00000850| 61 74 20 79 6f 75 0d 63 | 61 6c 6c 20 56 42 4c 52 |at you.c|all VBLR|
|00000860| 65 6d 6f 76 65 28 29 20 | 62 65 66 6f 72 65 20 71 |emove() |before q|
|00000870| 75 69 74 74 69 6e 67 2e | 20 4f 6e 63 65 20 69 6e |uitting.| Once in|
|00000880| 73 74 61 6c 6c 65 64 2c | 20 73 6c 6f 74 2d 62 61 |stalled,| slot-ba|
|00000890| 73 65 64 20 69 6e 74 65 | 72 72 75 70 74 20 74 61 |sed inte|rrupt ta|
|000008a0| 73 6b 73 0d 6b 65 65 70 | 20 67 6f 69 6e 67 20 66 |sks.keep| going f|
|000008b0| 6f 72 65 76 65 72 2e 20 | 28 54 75 72 6e 69 6e 67 |orever. |(Turning|
|000008c0| 20 6f 66 66 20 76 62 6c | 44 61 74 61 2d 3e 76 62 | off vbl|Data->vb|
|000008d0| 6c 2e 76 62 6c 43 6f 75 | 6e 74 20 64 69 73 61 62 |l.vblCou|nt disab|
|000008e0| 6c 65 73 20 74 68 65 20 | 72 6f 75 74 69 6e 65 2c |les the |routine,|
|000008f0| 20 62 75 74 0d 64 6f 65 | 73 6e 27 74 20 72 65 6d | but.doe|sn't rem|
|00000900| 6f 76 65 20 69 74 2e 29 | 20 54 68 65 20 74 61 73 |ove it.)| The tas|
|00000910| 6b 73 20 61 72 65 20 6e | 6f 74 20 72 65 6d 6f 76 |ks are n|ot remov|
|00000920| 65 64 20 62 79 20 74 68 | 65 20 46 69 6e 64 65 72 |ed by th|e Finder|
|00000930| 20 6f 72 20 53 79 73 74 | 65 6d 20 77 68 65 6e 20 | or Syst|em when |
|00000940| 79 6f 75 72 0d 61 70 70 | 6c 69 63 61 74 69 6f 6e |your.app|lication|
|00000950| 20 66 69 6e 69 73 68 65 | 73 2c 20 65 76 65 6e 20 | finishe|s, even |
|00000960| 74 68 6f 75 67 68 20 74 | 68 65 20 69 6e 74 65 72 |though t|he inter|
|00000970| 72 75 70 74 20 73 65 72 | 76 69 63 65 20 72 6f 75 |rupt ser|vice rou|
|00000980| 74 69 6e 65 27 73 20 63 | 6f 64 65 20 61 6e 64 20 |tine's c|ode and |
|00000990| 64 61 74 61 0d 77 69 6c | 6c 20 70 72 6f 62 61 62 |data.wil|l probab|
|000009a0| 6c 79 20 62 65 20 6f 76 | 65 72 77 72 69 74 74 65 |ly be ov|erwritte|
|000009b0| 6e 2e 0d 0d 41 63 74 75 | 61 6c 6c 79 2c 20 74 68 |n...Actu|ally, th|
|000009c0| 69 6e 67 73 20 61 72 65 | 6e 27 74 20 74 68 61 74 |ings are|n't that|
|000009d0| 20 62 61 64 2c 20 62 65 | 63 61 75 73 65 20 49 27 | bad, be|cause I'|
|000009e0| 76 65 20 61 64 64 65 64 | 20 61 20 63 61 6c 6c 20 |ve added| a call |
|000009f0| 74 6f 20 5f 61 74 65 78 | 69 74 28 29 0d 72 65 71 |to _atex|it().req|
|00000a00| 75 65 73 74 69 6e 67 20 | 74 68 61 74 20 61 6c 6c |uesting |that all|
|00000a10| 20 74 68 65 20 56 42 4c | 20 74 61 73 6b 73 20 69 | the VBL| tasks i|
|00000a20| 6e 73 74 61 6c 6c 65 64 | 20 62 79 20 56 42 4c 49 |nstalled| by VBLI|
|00000a30| 6e 73 74 61 6c 6c 28 29 | 20 62 65 20 72 65 6d 6f |nstall()| be remo|
|00000a40| 76 65 64 20 77 68 65 6e | 65 76 65 72 0d 74 68 65 |ved when|ever.the|
|00000a50| 20 70 72 6f 67 72 61 6d | 20 74 65 72 6d 69 6e 61 | program| termina|
|00000a60| 74 65 73 2c 20 77 68 65 | 74 68 65 72 20 6e 6f 72 |tes, whe|ther nor|
|00000a70| 6d 61 6c 6c 79 20 6f 72 | 20 61 62 6e 6f 72 6d 61 |mally or| abnorma|
|00000a80| 6c 6c 79 2e 20 54 68 69 | 73 20 70 72 65 76 65 6e |lly. Thi|s preven|
|00000a90| 74 73 20 74 68 65 0d 6f | 74 68 65 72 77 69 73 65 |ts the.o|therwise|
|00000aa0| 20 76 65 72 79 20 61 6e | 6e 6f 79 69 6e 67 20 63 | very an|noying c|
|00000ab0| 72 61 73 68 20 74 68 61 | 74 20 77 6f 75 6c 64 20 |rash tha|t would |
|00000ac0| 61 63 63 6f 6d 70 61 6e | 79 20 70 72 65 6d 61 74 |accompan|y premat|
|00000ad0| 75 72 65 20 74 65 72 6d | 69 6e 61 74 69 6f 6e 2c |ure term|ination,|
|00000ae0| 20 65 2e 67 2e 0d 62 79 | 20 74 79 70 69 6e 67 20 | e.g..by| typing |
|00000af0| 63 6f 6d 6d 61 6e 64 2d | 2e 2c 20 77 68 69 6c 65 |command-|., while|
|00000b00| 20 74 68 65 20 56 42 4c | 20 74 61 73 6b 20 69 73 | the VBL| task is|
|00000b10| 20 61 63 74 69 76 65 2e | 0d 0d 57 72 69 74 69 6e | active.|..Writin|
|00000b20| 67 20 61 6e 20 69 6e 74 | 65 72 72 75 70 74 20 73 |g an int|errupt s|
|00000b30| 65 72 76 69 63 65 20 72 | 6f 75 74 69 6e 65 2c 20 |ervice r|outine, |
|00000b40| 74 6f 20 62 65 20 63 61 | 6c 6c 65 64 20 6f 6e 63 |to be ca|lled onc|
|00000b50| 65 20 70 65 72 20 76 69 | 64 65 6f 20 66 72 61 6d |e per vi|deo fram|
|00000b60| 65 2c 20 69 73 0d 73 6c | 69 67 68 74 6c 79 20 74 |e, is.sl|ightly t|
|00000b70| 72 69 63 6b 79 2e 20 56 | 42 4c 49 6e 74 65 72 72 |ricky. V|BLInterr|
|00000b80| 75 70 74 53 65 72 76 69 | 63 65 52 6f 75 74 69 6e |uptServi|ceRoutin|
|00000b90| 65 20 64 6f 65 73 20 61 | 6c 6c 20 74 68 65 20 64 |e does a|ll the d|
|00000ba0| 69 72 74 79 20 77 6f 72 | 6b 2c 20 61 6e 64 20 74 |irty wor|k, and t|
|00000bb0| 68 65 6e 0d 63 61 6c 6c | 73 20 61 20 75 73 65 72 |hen.call|s a user|
|00000bc0| 2d 73 75 70 70 6c 69 65 | 64 20 73 75 62 72 6f 75 |-supplie|d subrou|
|00000bd0| 74 69 6e 65 20 74 68 61 | 74 20 64 6f 65 73 20 77 |tine tha|t does w|
|00000be0| 68 61 74 65 76 65 72 20 | 79 6f 75 20 77 61 6e 74 |hatever |you want|
|00000bf0| 2e 20 49 66 20 61 6c 6c | 20 79 6f 75 20 77 61 6e |. If all| you wan|
|00000c00| 74 20 74 6f 0d 64 6f 20 | 69 73 20 61 64 76 61 6e |t to.do |is advan|
|00000c10| 63 65 20 61 20 66 72 61 | 6d 65 20 63 6f 75 6e 74 |ce a fra|me count|
|00000c20| 65 72 20 75 6e 74 69 6c | 20 79 6f 75 20 72 65 61 |er until| you rea|
|00000c30| 63 68 20 74 68 65 20 64 | 65 73 69 72 65 64 20 6e |ch the d|esired n|
|00000c40| 75 6d 62 65 72 20 6f 66 | 20 66 72 61 6d 65 73 20 |umber of| frames |
|00000c50| 74 68 65 6e 0d 79 6f 75 | 20 6d 61 79 20 77 69 73 |then.you| may wis|
|00000c60| 68 20 74 6f 20 75 73 65 | 20 74 68 65 20 64 65 66 |h to use| the def|
|00000c70| 61 75 6c 74 20 46 72 61 | 6d 65 53 75 62 72 6f 75 |ault Fra|meSubrou|
|00000c80| 74 69 6e 65 28 29 20 69 | 6e 73 74 65 61 64 20 6f |tine() i|nstead o|
|00000c90| 66 20 77 72 69 74 69 6e | 67 20 79 6f 75 72 20 6f |f writin|g your o|
|00000ca0| 77 6e 2e 0d 50 75 74 20 | 74 68 65 20 61 64 64 72 |wn..Put |the addr|
|00000cb0| 65 73 73 20 6f 66 20 77 | 68 61 74 65 76 65 72 20 |ess of w|hatever |
|00000cc0| 72 6f 75 74 69 6e 65 20 | 79 6f 75 20 77 61 6e 74 |routine |you want|
|00000cd0| 20 74 6f 20 75 73 65 20 | 69 6e 74 6f 20 74 68 65 | to use |into the|
|00000ce0| 20 22 73 75 62 72 6f 75 | 74 69 6e 65 22 0d 65 6c | "subrou|tine".el|
|00000cf0| 65 6d 65 6e 74 20 6f 66 | 20 74 68 65 20 56 42 4c |ement of| the VBL|
|00000d00| 54 61 73 6b 41 6e 64 41 | 35 20 73 74 72 75 63 74 |TaskAndA|5 struct|
|00000d10| 75 72 65 2c 20 6f 72 2c | 20 74 6f 20 72 65 71 75 |ure, or,| to requ|
|00000d20| 65 73 74 20 75 73 65 20 | 6f 66 20 46 72 61 6d 65 |est use |of Frame|
|00000d30| 53 75 62 72 6f 75 74 69 | 6e 65 2c 0d 73 75 70 70 |Subrouti|ne,.supp|
|00000d40| 6c 79 20 74 68 65 20 61 | 64 64 72 65 73 73 20 4e |ly the a|ddress N|
|00000d50| 55 4c 4c 2e 0d 0d 46 72 | 61 6d 65 53 75 62 72 6f |ULL...Fr|ameSubro|
|00000d60| 75 74 69 6e 65 28 29 20 | 75 73 65 73 20 54 69 6d |utine() |uses Tim|
|00000d70| 65 72 2e 63 2e 20 49 66 | 20 74 68 69 73 20 70 72 |er.c. If| this pr|
|00000d80| 6f 67 72 61 6d 20 72 75 | 6e 73 20 6f 6e 20 61 6e |ogram ru|ns on an|
|00000d90| 20 6f 6c 64 20 53 79 73 | 74 65 6d 20 28 70 72 65 | old Sys|tem (pre|
|00000da0| 0d 36 2e 30 35 3f 29 20 | 6c 61 63 6b 69 6e 67 20 |.6.05?) |lacking |
|00000db0| 74 68 65 20 52 65 76 69 | 73 65 64 20 54 69 6d 65 |the Revi|sed Time|
|00000dc0| 20 4d 61 6e 61 67 65 72 | 2c 20 77 68 69 63 68 20 | Manager|, which |
|00000dd0| 54 69 6d 65 72 2e 63 20 | 72 65 71 75 69 72 65 73 |Timer.c |requires|
|00000de0| 2c 20 74 68 65 6e 0d 53 | 69 6d 70 6c 65 56 42 4c |, then.S|impleVBL|
|00000df0| 53 75 62 72 6f 75 74 69 | 6e 65 28 29 20 77 69 6c |Subrouti|ne() wil|
|00000e00| 6c 20 62 65 20 75 73 65 | 64 20 69 6e 73 74 65 61 |l be use|d instea|
|00000e10| 64 2e 20 54 68 65 20 54 | 69 6d 65 72 20 69 73 20 |d. The T|imer is |
|00000e20| 75 73 65 64 20 74 6f 20 | 64 69 73 63 61 72 64 0d |used to |discard.|
|00000e30| 73 70 75 72 69 6f 75 73 | 20 69 6e 74 65 72 72 75 |spurious| interru|
|00000e40| 70 74 73 20 74 68 61 74 | 20 6f 63 63 75 72 20 77 |pts that| occur w|
|00000e50| 69 74 68 69 6e 20 35 20 | 6d 73 20 6f 66 20 74 68 |ithin 5 |ms of th|
|00000e60| 65 20 70 72 65 76 69 6f | 75 73 2e 20 54 68 69 73 |e previo|us. This|
|00000e70| 20 69 73 20 6e 65 63 65 | 73 73 61 72 79 0d 62 65 | is nece|ssary.be|
|00000e80| 63 61 75 73 65 20 73 6f | 6d 65 20 6f 66 20 74 68 |cause so|me of th|
|00000e90| 65 20 41 70 70 6c 65 20 | 76 69 64 65 6f 20 63 61 |e Apple |video ca|
|00000ea0| 72 64 73 20 67 65 6e 65 | 72 61 74 65 20 73 65 76 |rds gene|rate sev|
|00000eb0| 65 72 61 6c 20 69 6e 74 | 65 72 72 75 70 74 73 20 |eral int|errupts |
|00000ec0| 64 75 72 69 6e 67 20 74 | 68 65 0d 76 65 72 74 69 |during t|he.verti|
|00000ed0| 63 61 6c 20 62 6c 61 6e | 6b 69 6e 67 20 69 6e 74 |cal blan|king int|
|00000ee0| 65 72 76 61 6c 2c 20 65 | 76 65 6e 20 74 68 6f 75 |erval, e|ven thou|
|00000ef0| 67 68 20 41 70 70 6c 65 | 27 73 20 64 6f 63 75 6d |gh Apple|'s docum|
|00000f00| 65 6e 74 61 74 69 6f 6e | 20 63 6c 65 61 72 6c 79 |entation| clearly|
|00000f10| 20 69 6e 64 69 63 61 74 | 65 73 0d 74 68 61 74 20 | indicat|es.that |
|00000f20| 74 68 65 79 20 73 68 6f | 75 6c 64 20 6f 6e 6c 79 |they sho|uld only|
|00000f30| 20 67 65 6e 65 72 61 74 | 65 20 6f 6e 65 2e 20 54 | generat|e one. T|
|00000f40| 68 65 20 66 69 78 20 28 | 68 6f 6c 64 69 6e 67 20 |he fix (|holding |
|00000f50| 6f 66 66 20 66 6f 72 20 | 35 20 6d 73 29 20 77 61 |off for |5 ms) wa|
|00000f60| 73 20 73 75 67 67 65 73 | 74 65 64 0d 62 79 20 52 |s sugges|ted.by R|
|00000f70| 61 79 6e 61 6c 64 20 43 | 6f 6d 74 6f 69 73 2e 0d |aynald C|omtois..|
|00000f80| 0d 54 68 65 20 31 39 39 | 32 20 41 70 70 6c 65 20 |.The 199|2 Apple |
|00000f90| 22 49 6e 73 69 64 65 20 | 4d 61 63 69 6e 74 6f 73 |"Inside |Macintos|
|00000fa0| 68 3a 20 50 72 6f 63 65 | 73 73 65 73 22 20 62 6f |h: Proce|sses" bo|
|00000fb0| 6f 6b 20 65 78 70 6c 61 | 69 6e 73 20 68 6f 77 20 |ok expla|ins how |
|00000fc0| 74 6f 20 74 61 73 6b 20 | 74 6f 20 62 65 0d 70 65 |to task |to be.pe|
|00000fd0| 72 66 6f 72 6d 65 64 20 | 65 61 63 68 20 74 69 6d |rformed |each tim|
|00000fe0| 65 20 79 6f 75 72 20 76 | 69 64 65 6f 20 64 65 76 |e your v|ideo dev|
|00000ff0| 69 63 65 20 70 72 6f 64 | 75 63 65 73 20 61 20 76 |ice prod|uces a v|
|00001000| 65 72 74 69 63 61 6c 20 | 62 6c 61 6e 6b 69 6e 67 |ertical |blanking|
|00001010| 20 6c 65 76 65 6c 20 28 | 69 2e 65 2e 0d 62 65 74 | level (|i.e..bet|
|00001020| 77 65 65 6e 20 76 69 64 | 65 6f 20 66 72 61 6d 65 |ween vid|eo frame|
|00001030| 73 29 2e 20 49 74 27 73 | 20 71 75 69 74 65 20 74 |s). It's| quite t|
|00001040| 72 69 63 6b 79 2e 20 54 | 68 65 72 65 66 6f 72 65 |ricky. T|herefore|
|00001050| 20 49 20 77 72 6f 74 65 | 20 61 20 67 65 6e 65 72 | I wrote| a gener|
|00001060| 69 63 20 6f 6e 65 2c 20 | 74 68 61 74 0d 69 6e 20 |ic one, |that.in |
|00001070| 74 75 72 6e 2c 20 63 61 | 6c 6c 73 20 79 6f 75 72 |turn, ca|lls your|
|00001080| 20 63 75 73 74 6f 6d 20 | 6f 6e 65 2c 20 61 66 74 | custom |one, aft|
|00001090| 65 72 20 61 6c 6c 20 74 | 68 65 20 74 72 69 63 6b |er all t|he trick|
|000010a0| 79 20 62 69 74 73 20 68 | 61 76 65 20 62 65 65 6e |y bits h|ave been|
|000010b0| 20 74 61 6b 65 6e 20 63 | 61 72 65 0d 6f 66 2e 0d | taken c|are.of..|
|000010c0| 0d 54 68 65 72 65 20 61 | 72 65 20 73 6f 6d 65 20 |.There a|re some |
|000010d0| 73 75 62 74 6c 65 74 69 | 65 73 20 74 6f 20 74 68 |subtleti|es to th|
|000010e0| 65 20 56 42 4c 20 69 6e | 74 65 72 72 75 70 74 20 |e VBL in|terrupt |
|000010f0| 73 65 72 76 69 63 65 20 | 72 6f 75 74 69 6e 65 2e |service |routine.|
|00001100| 20 54 68 65 20 6d 61 69 | 6e 20 6f 6e 65 20 69 73 | The mai|n one is|
|00001110| 0d 74 68 61 74 20 61 6c | 6c 20 74 68 65 20 4d 61 |.that al|l the Ma|
|00001120| 63 69 6e 74 6f 73 68 20 | 63 6f 6d 70 69 6c 65 72 |cintosh |compiler|
|00001130| 73 20 72 65 66 65 72 65 | 6e 63 65 20 67 6c 6f 62 |s refere|nce glob|
|00001140| 61 6c 20 76 61 72 69 61 | 62 6c 65 73 20 72 65 6c |al varia|bles rel|
|00001150| 61 74 69 76 65 20 74 6f | 20 72 65 67 69 73 74 65 |ative to| registe|
|00001160| 72 0d 41 35 2c 20 62 75 | 74 20 72 65 67 69 73 74 |r.A5, bu|t regist|
|00001170| 65 72 20 41 35 20 6d 61 | 79 20 68 61 76 65 20 74 |er A5 ma|y have t|
|00001180| 68 65 20 77 72 6f 6e 67 | 20 76 61 6c 75 65 20 28 |he wrong| value (|
|00001190| 63 6f 72 72 65 73 70 6f | 6e 64 69 6e 67 20 74 6f |correspo|nding to|
|000011a0| 20 61 20 64 69 66 66 65 | 72 65 6e 74 0d 61 70 70 | a diffe|rent.app|
|000011b0| 6c 69 63 61 74 69 6f 6e | 29 20 61 74 20 69 6e 74 |lication|) at int|
|000011c0| 65 72 72 75 70 74 20 74 | 69 6d 65 2e 20 53 6f 20 |errupt t|ime. So |
|000011d0| 77 65 20 73 61 76 65 64 | 20 74 68 65 20 72 69 67 |we saved| the rig|
|000011e0| 68 74 20 76 61 6c 75 65 | 20 6f 66 20 41 35 20 69 |ht value| of A5 i|
|000011f0| 6e 73 69 64 65 20 6f 75 | 72 0d 73 74 72 75 63 74 |nside ou|r.struct|
|00001200| 75 72 65 20 61 6e 64 20 | 72 65 73 74 6f 72 65 20 |ure and |restore |
|00001210| 41 35 20 62 65 66 6f 72 | 65 20 63 61 6c 6c 69 6e |A5 befor|e callin|
|00001220| 67 20 6f 75 72 20 54 61 | 73 6b 28 29 2e 0d 0d 41 |g our Ta|sk()...A|
|00001230| 20 66 75 72 74 68 65 72 | 20 73 75 62 74 6c 65 74 | further| subtlet|
|00001240| 79 20 69 73 20 74 68 61 | 74 20 74 68 65 20 6e 65 |y is tha|t the ne|
|00001250| 77 20 67 65 6e 65 72 61 | 74 69 6f 6e 20 6f 66 20 |w genera|tion of |
|00001260| 6f 70 74 69 6d 69 7a 69 | 6e 67 20 63 6f 6d 70 69 |optimizi|ng compi|
|00001270| 6c 65 72 73 20 6d 69 67 | 68 74 0d 6e 6f 74 69 63 |lers mig|ht.notic|
|00001280| 65 20 74 68 61 74 20 41 | 35 20 69 73 20 62 65 69 |e that A|5 is bei|
|00001290| 6e 67 20 6d 6f 64 69 66 | 69 65 64 2c 20 73 6f 20 |ng modif|ied, so |
|000012a0| 69 74 20 77 6f 75 6c 64 | 20 62 65 20 64 61 6e 67 |it would| be dang|
|000012b0| 65 72 6f 75 73 20 74 6f | 20 61 63 63 65 73 73 20 |erous to| access |
|000012c0| 67 6c 6f 62 61 6c 73 20 | 61 74 0d 61 6c 6c 20 69 |globals |at.all i|
|000012d0| 6e 20 49 6e 74 65 72 72 | 75 70 74 53 65 72 76 69 |n Interr|uptServi|
|000012e0| 63 65 52 6f 75 74 69 6e | 65 28 29 2c 20 65 76 65 |ceRoutin|e(), eve|
|000012f0| 6e 20 74 68 6f 75 67 68 | 20 69 74 27 73 20 73 61 |n though| it's sa|
|00001300| 66 65 20 74 6f 20 64 6f | 20 73 6f 20 69 6e 20 54 |fe to do| so in T|
|00001310| 61 73 6b 28 29 2e 20 49 | 6e 0d 66 61 63 74 20 54 |ask(). I|n.fact T|
|00001320| 61 73 6b 28 29 20 64 6f | 65 73 6e 27 74 20 75 73 |ask() do|esn't us|
|00001330| 65 20 61 6e 79 20 67 6c | 6f 62 61 6c 73 2c 20 62 |e any gl|obals, b|
|00001340| 75 74 20 69 74 20 63 6f | 75 6c 64 2e 0d 0d 54 68 |ut it co|uld...Th|
|00001350| 65 20 66 61 63 74 20 74 | 68 61 74 20 74 68 65 20 |e fact t|hat the |
|00001360| 61 64 64 72 65 73 73 20 | 6f 66 20 6f 75 72 20 73 |address |of our s|
|00001370| 74 72 75 63 74 75 72 65 | 20 69 73 20 69 6e 20 72 |tructure| is in r|
|00001380| 65 67 69 73 74 65 72 20 | 41 30 20 77 68 65 6e 20 |egister |A0 when |
|00001390| 74 68 65 20 69 6e 74 65 | 72 72 75 70 74 0d 73 65 |the inte|rrupt.se|
|000013a0| 72 76 69 63 65 20 72 6f | 75 74 69 6e 65 20 69 73 |rvice ro|utine is|
|000013b0| 20 63 61 6c 6c 65 64 20 | 72 65 73 75 6c 74 73 20 | called |results |
|000013c0| 66 72 6f 6d 20 74 68 65 | 20 66 61 63 74 20 74 68 |from the| fact th|
|000013d0| 61 74 20 74 68 65 20 6c | 6f 77 20 6c 65 76 65 6c |at the l|ow level|
|000013e0| 20 68 61 72 64 77 61 72 | 65 20 56 42 4c 0d 69 6e | hardwar|e VBL.in|
|000013f0| 74 65 72 72 75 70 74 20 | 69 73 20 69 6e 74 65 72 |terrupt |is inter|
|00001400| 63 65 70 74 65 64 20 62 | 79 20 74 68 65 20 6f 70 |cepted b|y the op|
|00001410| 65 72 61 74 69 6e 67 20 | 73 79 73 74 65 6d 2c 20 |erating |system, |
|00001420| 77 68 69 63 68 20 74 68 | 65 6e 20 63 61 6c 6c 73 |which th|en calls|
|00001430| 20 6f 75 72 20 72 6f 75 | 74 69 6e 65 2e 0d 0d 54 | our rou|tine...T|
|00001440| 68 65 20 56 42 4c 54 61 | 73 6b 41 6e 64 41 35 20 |he VBLTa|skAndA5 |
|00001450| 73 74 72 75 63 74 20 65 | 78 74 65 6e 64 73 20 41 |struct e|xtends A|
|00001460| 70 70 6c 65 27 73 20 56 | 42 4c 54 61 73 6b 20 73 |pple's V|BLTask s|
|00001470| 74 72 75 63 74 20 62 79 | 20 61 64 64 69 6e 67 20 |truct by| adding |
|00001480| 73 6f 6d 65 20 75 73 65 | 66 75 6c 0d 69 6e 66 6f |some use|ful.info|
|00001490| 72 6d 61 74 69 6f 6e 20 | 61 74 20 74 68 65 20 65 |rmation |at the e|
|000014a0| 6e 64 2e 20 59 6f 75 20 | 6d 61 79 20 63 68 6f 6f |nd. You |may choo|
|000014b0| 73 65 20 74 6f 20 63 6f | 70 79 20 74 68 69 73 2c |se to co|py this,|
|000014c0| 20 6f 72 20 64 65 66 69 | 6e 65 20 79 6f 75 72 20 | or defi|ne your |
|000014d0| 6f 77 6e 2c 20 61 64 64 | 69 6e 67 0d 6d 6f 72 65 |own, add|ing.more|
|000014e0| 20 73 74 75 66 66 20 61 | 74 20 74 68 65 20 65 6e | stuff a|t the en|
|000014f0| 64 2e 20 48 6f 77 65 76 | 65 72 2c 20 79 6f 75 20 |d. Howev|er, you |
|00001500| 6d 61 79 20 6e 6f 74 20 | 77 61 6e 74 20 74 6f 20 |may not |want to |
|00001510| 62 6f 74 68 65 72 2c 20 | 63 6f 6e 73 69 64 65 72 |bother, |consider|
|00001520| 69 6e 67 20 74 68 61 74 | 0d 79 6f 75 72 20 69 6e |ing that|.your in|
|00001530| 74 65 72 72 75 70 74 20 | 73 65 72 76 69 63 65 20 |terrupt |service |
|00001540| 72 6f 75 74 69 6e 65 20 | 63 61 6e 20 66 72 65 65 |routine |can free|
|00001550| 6c 79 20 61 63 63 65 73 | 73 20 67 6c 6f 62 61 6c |ly acces|s global|
|00001560| 20 76 61 72 69 61 62 6c | 65 73 2e 0d 41 6c 74 65 | variabl|es..Alte|
|00001570| 72 6e 61 74 69 76 65 6c | 79 2c 20 49 20 61 64 64 |rnativel|y, I add|
|00001580| 65 64 20 61 20 67 65 6e | 65 72 69 63 20 70 6f 69 |ed a gen|eric poi|
|00001590| 6e 74 65 72 20 61 74 20 | 74 68 65 20 65 6e 64 2c |nter at |the end,|
|000015a0| 20 77 68 69 63 68 20 79 | 6f 75 20 6d 61 79 20 75 | which y|ou may u|
|000015b0| 73 65 20 74 6f 20 70 61 | 73 73 0d 74 68 65 20 61 |se to pa|ss.the a|
|000015c0| 64 64 72 65 73 73 20 6f | 66 20 61 6e 79 20 73 74 |ddress o|f any st|
|000015d0| 75 66 66 20 74 68 61 74 | 20 79 6f 75 20 77 61 6e |uff that| you wan|
|000015e0| 74 20 66 6f 72 20 61 63 | 63 65 73 73 20 77 69 74 |t for ac|cess wit|
|000015f0| 68 69 6e 20 79 6f 75 72 | 20 73 75 62 72 6f 75 74 |hin your| subrout|
|00001600| 69 6e 65 2e 0d 0d 4d 61 | 63 69 6e 74 6f 73 68 20 |ine...Ma|cintosh |
|00001610| 54 65 63 68 6e 69 63 61 | 6c 20 4e 6f 74 65 20 31 |Technica|l Note 1|
|00001620| 38 30 20 28 22 4d 75 6c | 74 69 66 69 6e 64 65 72 |80 ("Mul|tifinder|
|00001630| 20 4d 69 73 63 65 6c 6c | 61 6e 65 61 22 29 2c 20 | Miscell|anea"), |
|00001640| 70 2e 20 35 20 73 61 79 | 73 3a 20 0d 22 47 65 74 |p. 5 say|s: ."Get|
|00001650| 56 42 4c 52 65 63 28 29 | 20 72 65 74 75 72 6e 73 |VBLRec()| returns|
|00001660| 20 74 68 65 20 61 64 64 | 72 65 73 73 0d 6f 66 20 | the add|ress.of |
|00001670| 74 68 65 20 56 42 4c 52 | 65 63 20 61 73 73 6f 63 |the VBLR|ec assoc|
|00001680| 69 61 74 65 64 20 77 69 | 74 68 20 6f 75 72 20 56 |iated wi|th our V|
|00001690| 42 4c 20 74 61 73 6b 2e | 20 54 68 69 73 20 77 6f |BL task.| This wo|
|000016a0| 72 6b 73 20 62 65 63 61 | 75 73 65 20 6f 6e 20 65 |rks beca|use on e|
|000016b0| 6e 74 72 79 20 69 6e 74 | 6f 20 74 68 65 0d 56 42 |ntry int|o the.VB|
|000016c0| 4c 20 74 61 73 6b 2c 20 | 41 30 20 70 6f 69 6e 74 |L task, |A0 point|
|000016d0| 73 20 74 6f 20 74 68 65 | 20 74 68 65 56 42 4c 54 |s to the| theVBLT|
|000016e0| 61 73 6b 20 66 69 65 6c | 64 20 69 6e 20 74 68 65 |ask fiel|d in the|
|000016f0| 20 56 42 4c 52 65 63 20 | 72 65 63 6f 72 64 2c 20 | VBLRec |record, |
|00001700| 77 68 69 63 68 20 69 73 | 20 74 68 65 0d 66 69 72 |which is| the.fir|
|00001710| 73 74 20 66 69 65 6c 64 | 20 69 6e 20 74 68 65 20 |st field| in the |
|00001720| 72 65 63 6f 72 64 20 61 | 6e 64 20 74 68 61 74 20 |record a|nd that |
|00001730| 69 73 20 74 68 65 20 61 | 64 64 72 65 73 73 20 77 |is the a|ddress w|
|00001740| 65 20 72 65 74 75 72 6e | 2e 20 4e 6f 74 65 20 74 |e return|. Note t|
|00001750| 68 61 74 20 74 68 69 73 | 0d 6d 65 74 68 6f 64 20 |hat this|.method |
|00001760| 77 6f 72 6b 73 20 77 68 | 65 74 68 65 72 20 74 68 |works wh|ether th|
|00001770| 65 20 56 42 4c 52 65 63 | 20 69 73 20 61 6c 6c 6f |e VBLRec| is allo|
|00001780| 63 61 74 65 64 20 67 6c | 6f 62 61 6c 6c 79 2c 20 |cated gl|obally, |
|00001790| 69 6e 20 74 68 65 20 68 | 65 61 70 2e 2e 2e 6f 72 |in the h|eap...or|
|000017a0| 2e 2e 2e 6f 6e 20 74 68 | 65 0d 73 74 61 63 6b 2e |...on th|e.stack.|
|000017b0| 20 2e 2e 2e 20 54 68 69 | 73 20 74 72 69 63 6b 20 | ... Thi|s trick |
|000017c0| 61 6c 6c 6f 77 73 20 75 | 73 20 74 6f 20 67 65 74 |allows u|s to get|
|000017d0| 20 74 6f 20 74 68 65 20 | 73 61 76 65 64 20 41 35 | to the |saved A5|
|000017e0| 2c 20 62 75 74 20 69 74 | 20 63 6f 75 6c 64 20 61 |, but it| could a|
|000017f0| 6c 73 6f 20 62 65 0d 75 | 73 65 64 20 74 6f 20 67 |lso be.u|sed to g|
|00001800| 65 74 20 74 6f 20 61 6e | 79 74 68 69 6e 67 20 77 |et to an|ything w|
|00001810| 65 20 77 61 6e 74 65 64 | 20 74 6f 20 73 74 6f 72 |e wanted| to stor|
|00001820| 65 20 69 6e 20 74 68 65 | 20 72 65 63 6f 72 64 2e |e in the| record.|
|00001830| 22 20 28 71 75 6f 74 65 | 64 20 62 79 20 4a 61 6d |" (quote|d by Jam|
|00001840| 69 65 0d 4d 63 43 61 72 | 74 68 79 20 69 6e 20 63 |ie.McCar|thy in c|
|00001850| 6f 6d 70 2e 73 79 73 2e | 6d 61 63 2e 70 72 6f 67 |omp.sys.|mac.prog|
|00001860| 20 31 30 2f 31 35 2f 39 | 32 2e 29 0d 0d 48 49 53 | 10/15/9|2.)..HIS|
|00001870| 54 4f 52 59 3a 0d 38 2f | 32 32 2f 39 32 20 64 67 |TORY:.8/|22/92 dg|
|00001880| 70 20 77 72 6f 74 65 20 | 69 74 2c 20 62 61 73 65 |p wrote |it, base|
|00001890| 64 20 6f 6e 20 63 6f 64 | 65 20 65 78 74 72 61 63 |d on cod|e extrac|
|000018a0| 74 65 64 20 66 72 6f 6d | 20 6d 79 20 4e 6f 69 73 |ted from| my Nois|
|000018b0| 65 56 42 4c 2e 63 0d 38 | 2f 32 36 2f 39 32 09 64 |eVBL.c.8|/26/92.d|
|000018c0| 67 70 09 61 64 64 65 64 | 20 56 42 4c 52 65 6d 6f |gp.added| VBLRemo|
|000018d0| 76 65 41 6c 6c 28 29 2c | 20 77 68 69 63 68 20 69 |veAll(),| which i|
|000018e0| 73 20 61 75 74 6f 6d 61 | 74 69 63 61 6c 6c 79 20 |s automa|tically |
|000018f0| 70 6c 61 63 65 64 20 69 | 6e 20 74 68 65 20 5f 61 |placed i|n the _a|
|00001900| 74 65 78 69 74 28 29 0d | 09 09 09 71 75 65 75 65 |texit().|...queue|
|00001910| 2c 20 73 6f 20 69 74 20 | 61 6c 6c 20 79 6f 75 72 |, so it |all your|
|00001920| 20 56 42 4c 20 74 61 73 | 6b 73 20 77 69 6c 6c 20 | VBL tas|ks will |
|00001930| 62 65 20 72 65 6d 6f 76 | 65 64 20 66 72 6f 6d 20 |be remov|ed from |
|00001940| 74 68 65 20 71 75 65 75 | 65 20 77 68 65 6e 0d 09 |the queu|e when..|
|00001950| 09 09 79 6f 75 72 20 70 | 72 6f 67 72 61 6d 20 65 |..your p|rogram e|
|00001960| 78 69 74 73 2c 20 77 68 | 65 74 68 65 72 20 6e 6f |xits, wh|ether no|
|00001970| 72 6d 61 6c 20 6f 72 20 | 61 62 6e 6f 72 6d 61 6c |rmal or |abnormal|
|00001980| 6c 79 2e 0d 39 2f 39 2f | 39 32 09 64 67 70 09 66 |ly..9/9/|92.dgp.f|
|00001990| 69 78 65 64 20 65 72 72 | 6f 6e 65 6f 75 73 20 61 |ixed err|oneous a|
|000019a0| 74 74 65 6d 70 74 20 74 | 6f 20 75 73 65 20 73 6c |ttempt t|o use sl|
|000019b0| 6f 74 20 7a 65 72 6f 20 | 77 68 65 6e 20 4e 55 4c |ot zero |when NUL|
|000019c0| 4c 20 64 65 76 69 63 65 | 20 77 61 73 20 70 61 73 |L device| was pas|
|000019d0| 73 65 64 2e 0d 39 2f 31 | 30 2f 39 32 09 64 67 70 |sed..9/1|0/92.dgp|
|000019e0| 09 61 64 64 65 64 20 63 | 61 6c 6c 73 20 74 6f 20 |.added c|alls to |
|000019f0| 56 4d 20 74 6f 20 48 6f | 6c 64 4d 65 6d 6f 72 79 |VM to Ho|ldMemory|
|00001a00| 28 29 20 61 6e 64 20 55 | 6e 48 6f 6c 64 4d 65 6d |() and U|nHoldMem|
|00001a10| 6f 72 79 28 29 2e 20 41 | 63 63 6f 72 64 69 6e 67 |ory(). A|ccording|
|00001a20| 20 74 6f 20 41 70 70 6c | 65 27 73 0d 09 09 09 4d | to Appl|e's....M|
|00001a30| 65 6d 6f 72 79 20 62 6f | 6f 6b 20 74 68 69 73 20 |emory bo|ok this |
|00001a40| 69 73 6e 27 74 20 73 74 | 72 69 63 74 6c 79 20 6e |isn't st|rictly n|
|00001a50| 65 63 65 73 73 61 72 79 | 2c 20 73 69 6e 63 65 20 |ecessary|, since |
|00001a60| 56 42 4c 20 74 61 73 6b | 73 20 77 69 6c 6c 20 0d |VBL task|s will .|
|00001a70| 09 09 09 62 65 20 63 61 | 6c 6c 65 64 20 6f 6e 6c |...be ca|lled onl|
|00001a80| 79 20 77 68 65 6e 20 69 | 74 27 73 20 73 61 66 65 |y when i|t's safe|
|00001a90| 2e 0d 39 2f 31 37 2f 39 | 32 09 64 67 70 09 54 72 |..9/17/9|2.dgp.Tr|
|00001aa0| 61 6e 73 66 65 72 72 65 | 64 20 46 72 61 6d 65 53 |ansferre|d FrameS|
|00001ab0| 75 62 72 6f 75 74 69 6e | 65 28 29 20 68 65 72 65 |ubroutin|e() here|
|00001ac0| 20 66 72 6f 6d 20 47 44 | 46 72 61 6d 65 52 61 74 | from GD|FrameRat|
|00001ad0| 65 2e 63 2e 20 4e 6f 77 | 20 75 73 65 20 0d 09 09 |e.c. Now| use ...|
|00001ae0| 09 46 72 61 6d 65 53 75 | 62 72 6f 75 74 69 6e 65 |.FrameSu|broutine|
|00001af0| 28 29 20 69 6e 73 74 65 | 61 64 20 6f 66 20 53 69 |() inste|ad of Si|
|00001b00| 6d 70 6c 65 56 42 4c 53 | 75 62 72 6f 75 74 69 6e |mpleVBLS|ubroutin|
|00001b10| 65 28 29 20 61 73 20 74 | 68 65 20 64 65 66 61 75 |e() as t|he defau|
|00001b20| 6c 74 2c 0d 09 09 09 70 | 72 6f 76 69 64 65 64 20 |lt,....p|rovided |
|00001b30| 77 65 20 63 61 6e 20 75 | 73 65 20 54 69 6d 65 72 |we can u|se Timer|
|00001b40| 2e 63 2c 20 6f 74 68 65 | 72 77 69 73 65 20 66 61 |.c, othe|rwise fa|
|00001b50| 6c 6c 20 62 61 63 6b 20 | 74 6f 20 75 73 69 6e 67 |ll back |to using|
|00001b60| 20 0d 09 09 09 53 69 6d | 70 6c 65 56 42 4c 53 75 | ....Sim|pleVBLSu|
|00001b70| 62 72 6f 75 74 69 6e 65 | 2e 0d 31 30 2f 39 2f 39 |broutine|..10/9/9|
|00001b80| 32 09 64 67 70 09 41 75 | 74 6f 6d 61 74 69 63 61 |2.dgp.Au|tomatica|
|00001b90| 6c 6c 79 20 73 65 74 20 | 75 70 20 61 6e 64 20 64 |lly set |up and d|
|00001ba0| 69 73 70 6f 73 65 20 6f | 66 20 74 68 65 20 74 69 |ispose o|f the ti|
|00001bb0| 6d 65 72 20 75 73 65 64 | 20 62 79 20 46 72 61 6d |mer used| by Fram|
|00001bc0| 65 53 75 62 72 6f 75 74 | 69 6e 65 2e 0d 09 09 09 |eSubrout|ine.....|
|00001bd0| 41 64 64 65 64 20 61 20 | 66 69 65 6c 64 20 74 6f |Added a |field to|
|00001be0| 20 74 68 65 20 56 42 4c | 54 61 73 6b 41 6e 64 41 | the VBL|TaskAndA|
|00001bf0| 35 20 73 74 72 75 63 74 | 75 72 65 20 74 6f 20 68 |5 struct|ure to h|
|00001c00| 6f 6c 64 20 74 68 65 20 | 74 69 6d 65 72 20 70 6f |old the |timer po|
|00001c10| 69 6e 74 65 72 2c 0d 09 | 09 09 69 6e 73 74 65 61 |inter,..|..instea|
|00001c20| 64 20 6f 66 20 75 73 69 | 6e 67 20 75 70 20 74 68 |d of usi|ng up th|
|00001c30| 65 20 67 65 6e 65 72 69 | 63 20 70 74 72 2e 0d 09 |e generi|c ptr...|
|00001c40| 09 09 57 41 52 4e 49 4e | 47 3a 20 6f 6c 64 20 70 |..WARNIN|G: old p|
|00001c50| 72 6f 67 72 61 6d 73 20 | 28 77 72 69 74 74 65 6e |rograms |(written|
|00001c60| 20 64 75 72 69 6e 67 20 | 39 2f 39 32 29 20 74 68 | during |9/92) th|
|00001c70| 61 74 20 65 78 70 6c 69 | 63 69 74 6c 79 20 72 65 |at expli|citly re|
|00001c80| 71 75 65 73 74 20 75 73 | 65 20 6f 66 20 0d 09 09 |quest us|e of ...|
|00001c90| 09 46 72 61 6d 65 53 75 | 62 72 6f 75 74 69 6e 65 |.FrameSu|broutine|
|00001ca0| 20 6d 75 73 74 20 62 65 | 20 63 68 61 6e 67 65 64 | must be| changed|
|00001cb0| 2c 20 62 65 63 61 75 73 | 65 20 61 74 20 74 68 61 |, becaus|e at tha|
|00001cc0| 74 20 74 69 6d 65 20 69 | 74 20 77 61 73 20 74 68 |t time i|t was th|
|00001cd0| 65 20 75 73 65 72 27 73 | 20 0d 09 09 09 72 65 73 |e user's| ....res|
|00001ce0| 70 6f 6e 73 69 62 69 6c | 69 74 79 20 74 6f 20 73 |ponsibil|ity to s|
|00001cf0| 65 74 20 75 70 20 61 6e | 64 20 64 69 73 70 6f 73 |et up an|d dispos|
|00001d00| 65 20 6f 66 20 74 68 65 | 20 74 69 6d 65 72 2c 20 |e of the| timer, |
|00001d10| 77 68 65 72 65 61 73 20 | 69 74 27 73 20 6e 6f 77 |whereas |it's now|
|00001d20| 20 64 6f 6e 65 20 0d 09 | 09 09 66 6f 72 20 79 6f | done ..|..for yo|
|00001d30| 75 2e 20 54 6f 20 72 65 | 6d 69 6e 64 20 79 6f 75 |u. To re|mind you|
|00001d40| 20 74 6f 20 6d 61 6b 65 | 20 74 68 69 73 20 63 68 | to make| this ch|
|00001d50| 61 6e 67 65 20 22 46 72 | 61 6d 65 53 75 62 72 6f |ange "Fr|ameSubro|
|00001d60| 75 74 69 6e 65 22 20 69 | 73 20 6e 6f 20 6c 6f 6e |utine" i|s no lon|
|00001d70| 67 65 72 20 0d 09 09 09 | 69 6e 20 56 69 64 65 6f |ger ....|in Video|
|00001d80| 54 6f 6f 6c 62 6f 78 2e | 68 2c 20 69 74 27 73 20 |Toolbox.|h, it's |
|00001d90| 74 72 65 61 74 65 64 20 | 61 73 20 61 20 70 72 69 |treated |as a pri|
|00001da0| 76 61 74 65 20 72 6f 75 | 74 69 6e 65 20 68 65 72 |vate rou|tine her|
|00001db0| 65 2e 20 54 6f 20 6f 62 | 74 61 69 6e 20 74 68 65 |e. To ob|tain the|
|00001dc0| 20 0d 09 09 09 73 65 72 | 76 69 63 65 73 20 6f 66 | ....ser|vices of|
|00001dd0| 20 46 72 61 6d 65 53 75 | 62 72 6f 75 74 69 6e 65 | FrameSu|broutine|
|00001de0| 2c 20 6a 75 73 74 20 73 | 70 65 63 69 66 79 20 61 |, just s|pecify a|
|00001df0| 20 4e 55 4c 4c 20 69 6e | 20 74 68 65 20 56 42 4c | NULL in| the VBL|
|00001e00| 54 61 73 6b 41 6e 64 41 | 35 20 0d 09 09 09 73 75 |TaskAndA|5 ....su|
|00001e10| 62 72 6f 75 74 69 6e 65 | 20 66 69 65 6c 64 2e 0d |broutine| field..|
|00001e20| 31 31 2f 31 37 2f 39 32 | 20 64 67 70 20 49 6e 20 |11/17/92| dgp In |
|00001e30| 56 42 4c 52 65 6d 6f 76 | 65 28 29 2c 20 66 69 72 |VBLRemov|e(), fir|
|00001e40| 73 74 20 64 69 73 61 62 | 6c 65 20 74 68 65 20 69 |st disab|le the i|
|00001e50| 6e 74 65 72 72 75 70 74 | 2c 20 74 68 65 6e 20 63 |nterrupt|, then c|
|00001e60| 6c 65 61 6e 20 75 70 2e | 0d 09 09 09 46 69 78 65 |lean up.|....Fixe|
|00001e70| 64 20 65 72 72 6f 72 20 | 74 68 61 74 20 63 6f 75 |d error |that cou|
|00001e80| 6c 64 20 63 61 75 73 65 | 20 62 75 73 20 65 72 72 |ld cause| bus err|
|00001e90| 6f 72 20 69 6e 20 56 42 | 4c 52 65 6d 6f 76 65 41 |or in VB|LRemoveA|
|00001ea0| 6c 6c 2e 0d 09 09 09 56 | 42 4c 49 6e 73 74 61 6c |ll.....V|BLInstal|
|00001eb0| 6c 28 29 20 6e 6f 77 20 | 69 6e 73 74 61 6c 6c 73 |l() now |installs|
|00001ec0| 20 56 42 4c 52 65 6d 6f | 76 65 41 6c 6c 28 29 20 | VBLRemo|veAll() |
|00001ed0| 6f 6e 6c 79 20 6f 6e 63 | 65 20 69 6e 20 74 68 65 |only onc|e in the|
|00001ee0| 20 5f 61 74 65 78 69 74 | 28 29 0d 09 09 09 71 75 | _atexit|()....qu|
|00001ef0| 65 75 65 2c 20 6e 6f 20 | 6d 61 74 74 65 72 20 68 |eue, no |matter h|
|00001f00| 6f 77 20 6d 61 6e 79 20 | 74 69 6d 65 73 20 79 6f |ow many |times yo|
|00001f10| 75 20 63 61 6c 6c 20 69 | 74 2e 0d 31 31 2f 32 34 |u call i|t..11/24|
|00001f20| 2f 39 32 20 64 67 70 20 | 4d 69 6e 6f 72 20 75 70 |/92 dgp |Minor up|
|00001f30| 64 61 74 69 6e 67 20 6f | 66 20 63 6f 6d 6d 65 6e |dating o|f commen|
|00001f40| 74 73 2e 0d 29 0d 2a 2f | 0d 23 69 6e 63 6c 75 64 |ts..).*/|.#includ|
|00001f50| 65 20 22 56 69 64 65 6f | 54 6f 6f 6c 62 6f 78 2e |e "Video|Toolbox.|
|00001f60| 68 22 0d 23 69 6e 63 6c | 75 64 65 20 3c 54 72 61 |h".#incl|ude <Tra|
|00001f70| 70 73 2e 68 3e 0d 76 6f | 69 64 20 56 42 4c 52 65 |ps.h>.vo|id VBLRe|
|00001f80| 6d 6f 76 65 41 6c 6c 28 | 76 6f 69 64 29 3b 0d 73 |moveAll(|void);.s|
|00001f90| 74 61 74 69 63 20 76 6f | 69 64 20 46 72 61 6d 65 |tatic vo|id Frame|
|00001fa0| 53 75 62 72 6f 75 74 69 | 6e 65 28 56 42 4c 54 61 |Subrouti|ne(VBLTa|
|00001fb0| 73 6b 41 6e 64 41 35 20 | 2a 76 62 6c 44 61 74 61 |skAndA5 |*vblData|
|00001fc0| 29 3b 0d 0d 2f 2a 20 54 | 68 69 73 20 69 73 20 6a |);../* T|his is j|
|00001fd0| 75 73 74 20 66 6f 72 20 | 72 65 66 65 72 65 6e 63 |ust for |referenc|
|00001fe0| 65 2e 20 54 68 65 20 6f | 72 69 67 69 6e 61 6c 20 |e. The o|riginal |
|00001ff0| 69 73 20 69 6e 20 56 69 | 64 65 6f 54 6f 6f 6c 62 |is in Vi|deoToolb|
|00002000| 6f 78 2e 68 0d 73 74 72 | 75 63 74 20 56 42 4c 54 |ox.h.str|uct VBLT|
|00002010| 61 73 6b 41 6e 64 41 35 | 20 7b 0d 20 20 20 20 76 |askAndA5| {. v|
|00002020| 6f 6c 61 74 69 6c 65 20 | 56 42 4c 54 61 73 6b 20 |olatile |VBLTask |
|00002030| 76 62 6c 3b 0d 20 20 20 | 20 6c 6f 6e 67 20 6f 75 |vbl;. | long ou|
|00002040| 72 41 35 3b 0d 20 20 20 | 20 76 6f 69 64 20 28 2a |rA5;. | void (*|
|00002050| 73 75 62 72 6f 75 74 69 | 6e 65 29 28 73 74 72 75 |subrouti|ne)(stru|
|00002060| 63 74 20 56 42 4c 54 61 | 73 6b 41 6e 64 41 35 20 |ct VBLTa|skAndA5 |
|00002070| 2a 76 62 6c 44 61 74 61 | 29 3b 0d 20 20 20 20 47 |*vblData|);. G|
|00002080| 44 48 61 6e 64 6c 65 20 | 64 65 76 69 63 65 3b 0d |DHandle |device;.|
|00002090| 20 20 20 20 6c 6f 6e 67 | 20 73 6c 6f 74 3b 0d 20 | long| slot;. |
|000020a0| 20 20 20 76 6f 6c 61 74 | 69 6c 65 20 6c 6f 6e 67 | volat|ile long|
|000020b0| 20 6e 65 77 46 72 61 6d | 65 3b 09 09 09 09 2f 2f | newFram|e;....//|
|000020c0| 20 42 6f 6f 6c 65 61 6e | 0d 20 20 20 20 76 6f 6c | Boolean|. vol|
|000020d0| 61 74 69 6c 65 20 6c 6f | 6e 67 20 66 72 61 6d 65 |atile lo|ng frame|
|000020e0| 73 4c 65 66 74 3b 09 09 | 09 2f 2f 20 63 6f 75 6e |sLeft;..|.// coun|
|000020f0| 74 20 64 6f 77 6e 20 74 | 6f 20 7a 65 72 6f 0d 20 |t down t|o zero. |
|00002100| 20 20 20 6c 6f 6e 67 20 | 66 72 61 6d 65 73 44 65 | long |framesDe|
|00002110| 73 69 72 65 64 3b 0d 20 | 20 20 20 54 69 6d 65 72 |sired;. | Timer|
|00002120| 20 2a 66 72 61 6d 65 54 | 69 6d 65 72 3b 09 09 09 | *frameT|imer;...|
|00002130| 09 09 2f 2f 20 74 69 6d | 65 20 6d 73 20 73 69 6e |..// tim|e ms sin|
|00002140| 63 65 20 6c 61 73 74 20 | 56 42 4c 20 69 6e 74 65 |ce last |VBL inte|
|00002150| 72 72 75 70 74 2c 20 73 | 65 65 20 54 69 6d 65 72 |rrupt, s|ee Timer|
|00002160| 2e 63 0d 20 20 20 20 76 | 6f 69 64 20 2a 70 74 72 |.c. v|oid *ptr|
|00002170| 3b 09 09 09 09 09 09 09 | 2f 2f 20 75 73 65 20 74 |;.......|// use t|
|00002180| 68 69 73 20 66 6f 72 20 | 77 68 61 74 65 76 65 72 |his for |whatever|
|00002190| 20 79 6f 75 20 77 61 6e | 74 0d 7d 3b 0d 74 79 70 | you wan|t.};.typ|
|000021a0| 65 64 65 66 20 73 74 72 | 75 63 74 20 56 42 4c 54 |edef str|uct VBLT|
|000021b0| 61 73 6b 41 6e 64 41 35 | 20 56 42 4c 54 61 73 6b |askAndA5| VBLTask|
|000021c0| 41 6e 64 41 35 3b 0d 2a | 2f 0d 23 64 65 66 69 6e |AndA5;.*|/.#defin|
|000021d0| 65 20 54 41 53 4b 5f 53 | 49 5a 45 20 31 30 30 30 |e TASK_S|IZE 1000|
|000021e0| 09 2f 2f 20 47 65 6e 65 | 72 6f 75 73 20 67 75 65 |.// Gene|rous gue|
|000021f0| 73 73 20 66 6f 72 20 73 | 69 7a 65 20 6f 66 20 72 |ss for s|ize of r|
|00002200| 6f 75 74 69 6e 65 0d 73 | 74 61 74 69 63 20 6c 6f |outine.s|tatic lo|
|00002210| 6e 67 20 76 6d 50 72 65 | 73 65 6e 74 3d 30 3b 0d |ng vmPre|sent=0;.|
|00002220| 0d 4f 53 45 72 72 20 56 | 42 4c 49 6e 73 74 61 6c |.OSErr V|BLInstal|
|00002230| 6c 28 56 42 4c 54 61 73 | 6b 41 6e 64 41 35 20 2a |l(VBLTas|kAndA5 *|
|00002240| 76 62 6c 44 61 74 61 2c | 47 44 48 61 6e 64 6c 65 |vblData,|GDHandle|
|00002250| 20 64 65 76 69 63 65 2c | 69 6e 74 20 66 72 61 6d | device,|int fram|
|00002260| 65 73 29 0d 2f 2f 20 74 | 72 69 76 69 61 6c 2c 20 |es).// t|rivial, |
|00002270| 62 75 74 20 76 65 72 62 | 6f 73 65 0d 7b 0d 09 73 |but verb|ose.{..s|
|00002280| 74 61 74 69 63 20 69 6e | 74 20 66 69 72 73 74 54 |tatic in|t firstT|
|00002290| 69 6d 65 3d 31 2c 73 6c | 6f 74 52 6f 75 74 69 6e |ime=1,sl|otRoutin|
|000022a0| 65 73 41 76 61 69 6c 61 | 62 6c 65 3b 0d 09 73 74 |esAvaila|ble;..st|
|000022b0| 61 74 69 63 20 6c 6f 6e | 67 20 74 69 6d 65 4d 61 |atic lon|g timeMa|
|000022c0| 6e 61 67 65 72 56 65 72 | 73 69 6f 6e 3d 30 3b 0d |nagerVer|sion=0;.|
|000022d0| 09 0d 09 69 66 28 66 69 | 72 73 74 54 69 6d 65 29 |...if(fi|rstTime)|
|000022e0| 7b 0d 09 09 66 69 72 73 | 74 54 69 6d 65 3d 30 3b |{...firs|tTime=0;|
|000022f0| 0d 09 09 73 6c 6f 74 52 | 6f 75 74 69 6e 65 73 41 |...slotR|outinesA|
|00002300| 76 61 69 6c 61 62 6c 65 | 3d 54 72 61 70 41 76 61 |vailable|=TrapAva|
|00002310| 69 6c 61 62 6c 65 28 5f | 53 6c 6f 74 56 49 6e 73 |ilable(_|SlotVIns|
|00002320| 74 61 6c 6c 29 3b 0d 09 | 09 47 65 73 74 61 6c 74 |tall);..|.Gestalt|
|00002330| 28 67 65 73 74 61 6c 74 | 56 4d 41 74 74 72 2c 26 |(gestalt|VMAttr,&|
|00002340| 76 6d 50 72 65 73 65 6e | 74 29 3b 0d 09 09 76 6d |vmPresen|t);...vm|
|00002350| 50 72 65 73 65 6e 74 20 | 26 3d 20 67 65 73 74 61 |Present |&= gesta|
|00002360| 6c 74 56 4d 50 72 65 73 | 65 6e 74 3b 0d 09 09 23 |ltVMPres|ent;...#|
|00002370| 69 66 6e 64 65 66 20 4d | 41 54 4c 41 42 0d 09 09 |ifndef M|ATLAB...|
|00002380| 09 5f 61 74 65 78 69 74 | 28 56 42 4c 52 65 6d 6f |._atexit|(VBLRemo|
|00002390| 76 65 41 6c 6c 29 3b 0d | 09 09 23 65 6e 64 69 66 |veAll);.|..#endif|
|000023a0| 0d 09 09 47 65 73 74 61 | 6c 74 28 67 65 73 74 61 |...Gesta|lt(gesta|
|000023b0| 6c 74 54 69 6d 65 4d 67 | 72 56 65 72 73 69 6f 6e |ltTimeMg|rVersion|
|000023c0| 2c 26 74 69 6d 65 4d 61 | 6e 61 67 65 72 56 65 72 |,&timeMa|nagerVer|
|000023d0| 73 69 6f 6e 29 3b 0d 09 | 7d 0d 09 76 62 6c 44 61 |sion);..|}..vblDa|
|000023e0| 74 61 2d 3e 64 65 76 69 | 63 65 3d 64 65 76 69 63 |ta->devi|ce=devic|
|000023f0| 65 3b 0d 09 69 66 28 64 | 65 76 69 63 65 21 3d 4e |e;..if(d|evice!=N|
|00002400| 55 4c 4c 20 26 26 20 73 | 6c 6f 74 52 6f 75 74 69 |ULL && s|lotRouti|
|00002410| 6e 65 73 41 76 61 69 6c | 61 62 6c 65 29 76 62 6c |nesAvail|able)vbl|
|00002420| 44 61 74 61 2d 3e 73 6c | 6f 74 3d 47 65 74 44 65 |Data->sl|ot=GetDe|
|00002430| 76 69 63 65 53 6c 6f 74 | 28 64 65 76 69 63 65 29 |viceSlot|(device)|
|00002440| 3b 0d 09 65 6c 73 65 20 | 76 62 6c 44 61 74 61 2d |;..else |vblData-|
|00002450| 3e 73 6c 6f 74 3d 2d 31 | 3b 0d 09 76 62 6c 44 61 |>slot=-1|;..vblDa|
|00002460| 74 61 2d 3e 76 62 6c 2e | 76 62 6c 41 64 64 72 3d |ta->vbl.|vblAddr=|
|00002470| 28 50 72 6f 63 50 74 72 | 29 56 42 4c 49 6e 74 65 |(ProcPtr|)VBLInte|
|00002480| 72 72 75 70 74 53 65 72 | 76 69 63 65 52 6f 75 74 |rruptSer|viceRout|
|00002490| 69 6e 65 3b 0d 09 76 62 | 6c 44 61 74 61 2d 3e 76 |ine;..vb|lData->v|
|000024a0| 62 6c 2e 71 54 79 70 65 | 3d 76 54 79 70 65 3b 0d |bl.qType|=vType;.|
|000024b0| 09 76 62 6c 44 61 74 61 | 2d 3e 76 62 6c 2e 76 62 |.vblData|->vbl.vb|
|000024c0| 6c 43 6f 75 6e 74 3d 30 | 3b 09 2f 2a 20 49 6e 69 |lCount=0|;./* Ini|
|000024d0| 74 69 61 6c 6c 79 20 64 | 69 73 61 62 6c 65 20 74 |tially d|isable t|
|000024e0| 68 65 20 69 6e 74 65 72 | 72 75 70 74 20 73 65 72 |he inter|rupt ser|
|000024f0| 76 69 63 65 20 72 6f 75 | 74 69 6e 65 20 2a 2f 0d |vice rou|tine */.|
|00002500| 09 76 62 6c 44 61 74 61 | 2d 3e 76 62 6c 2e 76 62 |.vblData|->vbl.vb|
|00002510| 6c 50 68 61 73 65 3d 30 | 3b 0d 09 76 62 6c 44 61 |lPhase=0|;..vblDa|
|00002520| 74 61 2d 3e 6f 75 72 41 | 35 3d 53 65 74 43 75 72 |ta->ourA|5=SetCur|
|00002530| 72 65 6e 74 41 35 28 29 | 3b 0d 09 69 66 28 76 62 |rentA5()|;..if(vb|
|00002540| 6c 44 61 74 61 2d 3e 73 | 75 62 72 6f 75 74 69 6e |lData->s|ubroutin|
|00002550| 65 3d 3d 4e 55 4c 4c 29 | 7b 0d 09 09 69 66 28 74 |e==NULL)|{...if(t|
|00002560| 69 6d 65 4d 61 6e 61 67 | 65 72 56 65 72 73 69 6f |imeManag|erVersio|
|00002570| 6e 3e 3d 67 65 73 74 61 | 6c 74 52 65 76 69 73 65 |n>=gesta|ltRevise|
|00002580| 64 54 69 6d 65 4d 67 72 | 29 7b 0d 09 09 09 76 62 |dTimeMgr|){....vb|
|00002590| 6c 44 61 74 61 2d 3e 66 | 72 61 6d 65 54 69 6d 65 |lData->f|rameTime|
|000025a0| 72 3d 4e 65 77 54 69 6d | 65 72 28 29 3b 0d 09 09 |r=NewTim|er();...|
|000025b0| 09 53 74 61 72 74 54 69 | 6d 65 72 28 76 62 6c 44 |.StartTi|mer(vblD|
|000025c0| 61 74 61 2d 3e 66 72 61 | 6d 65 54 69 6d 65 72 29 |ata->fra|meTimer)|
|000025d0| 3b 0d 09 09 09 76 62 6c | 44 61 74 61 2d 3e 73 75 |;....vbl|Data->su|
|000025e0| 62 72 6f 75 74 69 6e 65 | 3d 46 72 61 6d 65 53 75 |broutine|=FrameSu|
|000025f0| 62 72 6f 75 74 69 6e 65 | 3b 0d 09 09 7d 0d 09 09 |broutine|;...}...|
|00002600| 65 6c 73 65 20 76 62 6c | 44 61 74 61 2d 3e 73 75 |else vbl|Data->su|
|00002610| 62 72 6f 75 74 69 6e 65 | 3d 53 69 6d 70 6c 65 56 |broutine|=SimpleV|
|00002620| 42 4c 53 75 62 72 6f 75 | 74 69 6e 65 3b 0d 09 7d |BLSubrou|tine;..}|
|00002630| 0d 09 76 62 6c 44 61 74 | 61 2d 3e 6e 65 77 46 72 |..vblDat|a->newFr|
|00002640| 61 6d 65 3d 30 3b 0d 09 | 76 62 6c 44 61 74 61 2d |ame=0;..|vblData-|
|00002650| 3e 66 72 61 6d 65 73 4c | 65 66 74 3d 76 62 6c 44 |>framesL|eft=vblD|
|00002660| 61 74 61 2d 3e 66 72 61 | 6d 65 73 44 65 73 69 72 |ata->fra|mesDesir|
|00002670| 65 64 3d 66 72 61 6d 65 | 73 3b 0d 09 69 66 28 76 |ed=frame|s;..if(v|
|00002680| 6d 50 72 65 73 65 6e 74 | 29 7b 0d 09 09 48 6f 6c |mPresent|){...Hol|
|00002690| 64 4d 65 6d 6f 72 79 28 | 76 62 6c 44 61 74 61 2c |dMemory(|vblData,|
|000026a0| 73 69 7a 65 6f 66 28 2a | 76 62 6c 44 61 74 61 29 |sizeof(*|vblData)|
|000026b0| 29 3b 0d 09 09 48 6f 6c | 64 4d 65 6d 6f 72 79 28 |);...Hol|dMemory(|
|000026c0| 76 62 6c 44 61 74 61 2d | 3e 76 62 6c 2e 76 62 6c |vblData-|>vbl.vbl|
|000026d0| 41 64 64 72 2c 54 41 53 | 4b 5f 53 49 5a 45 29 3b |Addr,TAS|K_SIZE);|
|000026e0| 0d 09 09 48 6f 6c 64 4d | 65 6d 6f 72 79 28 76 62 |...HoldM|emory(vb|
|000026f0| 6c 44 61 74 61 2d 3e 73 | 75 62 72 6f 75 74 69 6e |lData->s|ubroutin|
|00002700| 65 2c 54 41 53 4b 5f 53 | 49 5a 45 29 3b 0d 09 7d |e,TASK_S|IZE);..}|
|00002710| 0d 09 69 66 28 76 62 6c | 44 61 74 61 2d 3e 73 6c |..if(vbl|Data->sl|
|00002720| 6f 74 3e 3d 30 29 72 65 | 74 75 72 6e 20 53 6c 6f |ot>=0)re|turn Slo|
|00002730| 74 56 49 6e 73 74 61 6c | 6c 28 28 51 45 6c 65 6d |tVInstal|l((QElem|
|00002740| 50 74 72 29 76 62 6c 44 | 61 74 61 2c 76 62 6c 44 |Ptr)vblD|ata,vblD|
|00002750| 61 74 61 2d 3e 73 6c 6f | 74 29 3b 0d 09 65 6c 73 |ata->slo|t);..els|
|00002760| 65 20 72 65 74 75 72 6e | 20 56 49 6e 73 74 61 6c |e return| VInstal|
|00002770| 6c 28 28 51 45 6c 65 6d | 50 74 72 29 76 62 6c 44 |l((QElem|Ptr)vblD|
|00002780| 61 74 61 29 3b 0d 7d 0d | 0d 4f 53 45 72 72 20 56 |ata);.}.|.OSErr V|
|00002790| 42 4c 52 65 6d 6f 76 65 | 28 56 42 4c 54 61 73 6b |BLRemove|(VBLTask|
|000027a0| 41 6e 64 41 35 20 2a 76 | 62 6c 44 61 74 61 29 0d |AndA5 *v|blData).|
|000027b0| 7b 0d 20 20 20 20 4f 53 | 45 72 72 20 65 72 72 6f |{. OS|Err erro|
|000027c0| 72 3b 0d 0d 09 2f 2f 20 | 6f 6e 6c 79 20 72 65 6d |r;...// |only rem|
|000027d0| 6f 76 65 20 69 74 20 69 | 66 20 77 65 20 69 6e 73 |ove it i|f we ins|
|000027e0| 74 61 6c 6c 65 64 20 69 | 74 0d 09 69 66 28 76 62 |talled i|t..if(vb|
|000027f0| 6c 44 61 74 61 2d 3e 76 | 62 6c 2e 76 62 6c 41 64 |lData->v|bl.vblAd|
|00002800| 64 72 20 21 3d 20 28 50 | 72 6f 63 50 74 72 29 56 |dr != (P|rocPtr)V|
|00002810| 42 4c 49 6e 74 65 72 72 | 75 70 74 53 65 72 76 69 |BLInterr|uptServi|
|00002820| 63 65 52 6f 75 74 69 6e | 65 29 72 65 74 75 72 6e |ceRoutin|e)return|
|00002830| 3b 0d 09 69 66 28 76 62 | 6c 44 61 74 61 2d 3e 73 |;..if(vb|lData->s|
|00002840| 6c 6f 74 3e 3d 30 29 65 | 72 72 6f 72 3d 53 6c 6f |lot>=0)e|rror=Slo|
|00002850| 74 56 52 65 6d 6f 76 65 | 28 28 51 45 6c 65 6d 50 |tVRemove|((QElemP|
|00002860| 74 72 29 76 62 6c 44 61 | 74 61 2c 76 62 6c 44 61 |tr)vblDa|ta,vblDa|
|00002870| 74 61 2d 3e 73 6c 6f 74 | 29 3b 0d 09 65 6c 73 65 |ta->slot|);..else|
|00002880| 20 65 72 72 6f 72 3d 56 | 52 65 6d 6f 76 65 28 28 | error=V|Remove((|
|00002890| 51 45 6c 65 6d 50 74 72 | 29 76 62 6c 44 61 74 61 |QElemPtr|)vblData|
|000028a0| 29 3b 0d 09 69 66 28 76 | 6d 50 72 65 73 65 6e 74 |);..if(v|mPresent|
|000028b0| 29 7b 0d 09 09 55 6e 68 | 6f 6c 64 4d 65 6d 6f 72 |){...Unh|oldMemor|
|000028c0| 79 28 76 62 6c 44 61 74 | 61 2c 73 69 7a 65 6f 66 |y(vblDat|a,sizeof|
|000028d0| 28 76 62 6c 44 61 74 61 | 29 29 3b 0d 09 09 55 6e |(vblData|));...Un|
|000028e0| 68 6f 6c 64 4d 65 6d 6f | 72 79 28 76 62 6c 44 61 |holdMemo|ry(vblDa|
|000028f0| 74 61 2d 3e 76 62 6c 2e | 76 62 6c 41 64 64 72 2c |ta->vbl.|vblAddr,|
|00002900| 54 41 53 4b 5f 53 49 5a | 45 29 3b 0d 09 09 55 6e |TASK_SIZ|E);...Un|
|00002910| 68 6f 6c 64 4d 65 6d 6f | 72 79 28 76 62 6c 44 61 |holdMemo|ry(vblDa|
|00002920| 74 61 2d 3e 73 75 62 72 | 6f 75 74 69 6e 65 2c 54 |ta->subr|outine,T|
|00002930| 41 53 4b 5f 53 49 5a 45 | 29 3b 0d 09 7d 0d 09 69 |ASK_SIZE|);..}..i|
|00002940| 66 28 76 62 6c 44 61 74 | 61 2d 3e 73 75 62 72 6f |f(vblDat|a->subro|
|00002950| 75 74 69 6e 65 3d 3d 46 | 72 61 6d 65 53 75 62 72 |utine==F|rameSubr|
|00002960| 6f 75 74 69 6e 65 20 26 | 26 20 76 62 6c 44 61 74 |outine &|& vblDat|
|00002970| 61 2d 3e 66 72 61 6d 65 | 54 69 6d 65 72 21 3d 4e |a->frame|Timer!=N|
|00002980| 55 4c 4c 29 0d 09 09 44 | 69 73 70 6f 73 65 54 69 |ULL)...D|isposeTi|
|00002990| 6d 65 72 28 76 62 6c 44 | 61 74 61 2d 3e 66 72 61 |mer(vblD|ata->fra|
|000029a0| 6d 65 54 69 6d 65 72 29 | 3b 0d 09 72 65 74 75 72 |meTimer)|;..retur|
|000029b0| 6e 20 65 72 72 6f 72 3b | 0d 7d 0d 0d 76 6f 69 64 |n error;|.}..void|
|000029c0| 20 56 42 4c 52 65 6d 6f | 76 65 41 6c 6c 28 76 6f | VBLRemo|veAll(vo|
|000029d0| 69 64 29 0d 7b 0d 09 51 | 48 64 72 50 74 72 20 71 |id).{..Q|HdrPtr q|
|000029e0| 48 65 61 64 65 72 3b 0d | 09 51 45 6c 65 6d 50 74 |Header;.|.QElemPt|
|000029f0| 72 20 71 3b 0d 09 0d 09 | 71 48 65 61 64 65 72 3d |r q;....|qHeader=|
|00002a00| 47 65 74 56 42 4c 51 48 | 64 72 28 29 3b 0d 09 71 |GetVBLQH|dr();..q|
|00002a10| 3d 71 48 65 61 64 65 72 | 2d 3e 71 48 65 61 64 3b |=qHeader|->qHead;|
|00002a20| 0d 09 77 68 69 6c 65 28 | 71 21 3d 4e 55 4c 4c 29 |..while(|q!=NULL)|
|00002a30| 7b 0d 09 09 56 42 4c 52 | 65 6d 6f 76 65 28 28 56 |{...VBLR|emove((V|
|00002a40| 42 4c 54 61 73 6b 41 6e | 64 41 35 20 2a 29 71 29 |BLTaskAn|dA5 *)q)|
|00002a50| 3b 09 2f 2f 20 6f 6e 6c | 79 20 72 65 6d 6f 76 65 |;.// onl|y remove|
|00002a60| 73 20 6f 75 72 73 0d 09 | 09 71 3d 71 2d 3e 71 4c |s ours..|.q=q->qL|
|00002a70| 69 6e 6b 3b 0d 09 7d 0d | 7d 09 0d 0d 23 70 72 61 |ink;..}.|}...#pra|
|00002a80| 67 6d 61 20 6f 70 74 69 | 6f 6e 73 28 21 70 72 6f |gma opti|ons(!pro|
|00002a90| 66 69 6c 65 29 09 2f 2f | 20 69 74 20 77 6f 75 6c |file).//| it woul|
|00002aa0| 64 20 62 65 20 64 61 6e | 67 65 72 6f 75 73 20 74 |d be dan|gerous t|
|00002ab0| 6f 20 63 61 6c 6c 20 74 | 68 65 20 70 72 6f 66 69 |o call t|he profi|
|00002ac0| 6c 65 72 20 66 72 6f 6d | 20 68 65 72 65 0d 23 70 |ler from| here.#p|
|00002ad0| 72 61 67 6d 61 20 6f 70 | 74 69 6f 6e 73 28 61 73 |ragma op|tions(as|
|00002ae0| 73 69 67 6e 5f 72 65 67 | 69 73 74 65 72 73 2c 72 |sign_reg|isters,r|
|00002af0| 65 64 75 6e 64 61 6e 74 | 5f 6c 6f 61 64 73 29 0d |edundant|_loads).|
|00002b00| 50 74 72 20 47 65 74 41 | 30 28 76 6f 69 64 29 3d |Ptr GetA|0(void)=|
|00002b10| 30 78 32 30 30 38 3b 09 | 2f 2a 20 4d 4f 56 45 2e |0x2008;.|/* MOVE.|
|00002b20| 4c 20 41 30 2c 44 30 20 | 2a 2f 0d 0d 76 6f 69 64 |L A0,D0 |*/..void|
|00002b30| 20 56 42 4c 49 6e 74 65 | 72 72 75 70 74 53 65 72 | VBLInte|rruptSer|
|00002b40| 76 69 63 65 52 6f 75 74 | 69 6e 65 28 76 6f 69 64 |viceRout|ine(void|
|00002b50| 29 0d 7b 0d 09 72 65 67 | 69 73 74 65 72 20 6c 6f |).{..reg|ister lo|
|00002b60| 6e 67 20 6f 6c 64 41 35 | 3b 0d 09 72 65 67 69 73 |ng oldA5|;..regis|
|00002b70| 74 65 72 20 56 42 4c 54 | 61 73 6b 41 6e 64 41 35 |ter VBLT|askAndA5|
|00002b80| 20 2a 76 62 6c 44 61 74 | 61 3b 0d 0d 09 76 62 6c | *vblDat|a;...vbl|
|00002b90| 44 61 74 61 20 3d 20 28 | 56 42 4c 54 61 73 6b 41 |Data = (|VBLTaskA|
|00002ba0| 6e 64 41 35 20 2a 29 47 | 65 74 41 30 28 29 3b 0d |ndA5 *)G|etA0();.|
|00002bb0| 09 6f 6c 64 41 35 20 3d | 20 53 65 74 41 35 28 76 |.oldA5 =| SetA5(v|
|00002bc0| 62 6c 44 61 74 61 2d 3e | 6f 75 72 41 35 29 3b 0d |blData->|ourA5);.|
|00002bd0| 09 28 2a 76 62 6c 44 61 | 74 61 2d 3e 73 75 62 72 |.(*vblDa|ta->subr|
|00002be0| 6f 75 74 69 6e 65 29 28 | 76 62 6c 44 61 74 61 29 |outine)(|vblData)|
|00002bf0| 3b 09 09 2f 2f 20 63 61 | 6c 6c 20 75 73 65 72 27 |;..// ca|ll user'|
|00002c00| 73 20 74 61 73 6b 2c 20 | 70 61 73 73 20 64 61 74 |s task, |pass dat|
|00002c10| 61 20 70 74 72 0d 09 53 | 65 74 41 35 28 6f 6c 64 |a ptr..S|etA5(old|
|00002c20| 41 35 29 3b 0d 7d 0d 0d | 76 6f 69 64 20 53 69 6d |A5);.}..|void Sim|
|00002c30| 70 6c 65 56 42 4c 53 75 | 62 72 6f 75 74 69 6e 65 |pleVBLSu|broutine|
|00002c40| 28 56 42 4c 54 61 73 6b | 41 6e 64 41 35 20 2a 76 |(VBLTask|AndA5 *v|
|00002c50| 62 6c 44 61 74 61 29 0d | 7b 0d 09 76 62 6c 44 61 |blData).|{..vblDa|
|00002c60| 74 61 2d 3e 6e 65 77 46 | 72 61 6d 65 3d 31 3b 0d |ta->newF|rame=1;.|
|00002c70| 09 69 66 28 2d 2d 76 62 | 6c 44 61 74 61 2d 3e 66 |.if(--vb|lData->f|
|00002c80| 72 61 6d 65 73 4c 65 66 | 74 3e 30 29 20 76 62 6c |ramesLef|t>0) vbl|
|00002c90| 44 61 74 61 2d 3e 76 62 | 6c 2e 76 62 6c 43 6f 75 |Data->vb|l.vblCou|
|00002ca0| 6e 74 3d 31 3b 0d 7d 0d | 0d 73 74 61 74 69 63 20 |nt=1;.}.|.static |
|00002cb0| 76 6f 69 64 20 46 72 61 | 6d 65 53 75 62 72 6f 75 |void Fra|meSubrou|
|00002cc0| 74 69 6e 65 28 56 42 4c | 54 61 73 6b 41 6e 64 41 |tine(VBL|TaskAndA|
|00002cd0| 35 20 2a 76 62 6c 44 61 | 74 61 29 0d 7b 0d 09 2f |5 *vblDa|ta).{../|
|00002ce0| 2f 20 54 68 65 20 31 39 | 39 31 2d 32 20 41 70 70 |/ The 19|91-2 App|
|00002cf0| 6c 65 20 76 69 64 65 6f | 20 63 61 72 64 73 20 65 |le video| cards e|
|00002d00| 6d 69 74 20 73 65 76 65 | 72 61 6c 20 76 62 6c 20 |mit seve|ral vbl |
|00002d10| 69 6e 74 65 72 72 75 70 | 74 73 20 70 65 72 20 66 |interrup|ts per f|
|00002d20| 72 61 6d 65 2c 0d 09 2f | 2f 20 77 68 69 63 68 20 |rame,../|/ which |
|00002d30| 76 69 6f 6c 61 74 65 73 | 20 41 70 70 6c 65 27 73 |violates| Apple's|
|00002d40| 20 64 6f 63 75 6d 65 6e | 74 61 74 69 6f 6e 2e 0d | documen|tation..|
|00002d50| 09 2f 2f 20 53 6f 20 77 | 65 20 75 73 65 20 74 68 |.// So w|e use th|
|00002d60| 65 20 54 69 6d 65 20 4d | 61 6e 61 67 65 72 20 74 |e Time M|anager t|
|00002d70| 6f 20 69 67 6e 6f 72 65 | 20 61 6e 79 20 69 6e 74 |o ignore| any int|
|00002d80| 65 72 72 75 70 74 20 74 | 68 61 74 20 6f 63 63 75 |errupt t|hat occu|
|00002d90| 72 73 20 77 69 74 68 69 | 6e 20 35 20 6d 73 0d 09 |rs withi|n 5 ms..|
|00002da0| 2f 2f 20 6f 66 20 74 68 | 65 20 6d 6f 73 74 20 72 |// of th|e most r|
|00002db0| 65 63 65 6e 74 20 69 6e | 74 65 72 72 75 70 74 2c |ecent in|terrupt,|
|00002dc0| 20 66 6f 72 20 74 68 61 | 74 20 76 69 64 65 6f 20 | for tha|t video |
|00002dd0| 64 65 76 69 63 65 2e 0d | 09 2f 2f 20 54 68 75 73 |device..|.// Thus|
|00002de0| 20 74 68 69 73 20 66 72 | 61 6d 65 20 63 6f 75 6e | this fr|ame coun|
|00002df0| 74 65 72 20 73 68 6f 75 | 6c 64 20 77 6f 72 6b 20 |ter shou|ld work |
|00002e00| 63 6f 72 72 65 63 74 6c | 79 20 6f 6e 20 61 6c 6c |correctl|y on all|
|00002e10| 20 76 69 64 65 6f 20 63 | 61 72 64 73 2e 0d 09 2f | video c|ards.../|
|00002e20| 2f 20 53 75 67 67 65 73 | 74 65 64 20 62 79 20 52 |/ Sugges|ted by R|
|00002e30| 61 79 6e 61 6c 64 20 43 | 6f 6d 74 6f 69 73 2e 0d |aynald C|omtois..|
|00002e40| 09 69 66 28 53 74 6f 70 | 54 69 6d 65 72 28 76 62 |.if(Stop|Timer(vb|
|00002e50| 6c 44 61 74 61 2d 3e 66 | 72 61 6d 65 54 69 6d 65 |lData->f|rameTime|
|00002e60| 72 29 3e 35 30 30 30 29 | 7b 0d 09 09 76 62 6c 44 |r)>5000)|{...vblD|
|00002e70| 61 74 61 2d 3e 6e 65 77 | 46 72 61 6d 65 3d 31 3b |ata->new|Frame=1;|
|00002e80| 09 09 09 09 09 09 09 09 | 09 2f 2f 20 73 65 74 20 |........|.// set |
|00002e90| 6e 65 77 2d 66 72 61 6d | 65 20 66 6c 61 67 0d 09 |new-fram|e flag..|
|00002ea0| 09 69 66 28 2d 2d 76 62 | 6c 44 61 74 61 2d 3e 66 |.if(--vb|lData->f|
|00002eb0| 72 61 6d 65 73 4c 65 66 | 74 3e 30 29 20 76 62 6c |ramesLef|t>0) vbl|
|00002ec0| 44 61 74 61 2d 3e 76 62 | 6c 2e 76 62 6c 43 6f 75 |Data->vb|l.vblCou|
|00002ed0| 6e 74 3d 31 3b 09 2f 2f | 20 72 65 2d 65 6e 61 62 |nt=1;.//| re-enab|
|00002ee0| 6c 65 20 69 6e 74 65 72 | 72 75 70 74 0d 09 7d 65 |le inter|rupt..}e|
|00002ef0| 6c 73 65 20 76 62 6c 44 | 61 74 61 2d 3e 76 62 6c |lse vblD|ata->vbl|
|00002f00| 2e 76 62 6c 43 6f 75 6e | 74 3d 31 3b 09 09 09 09 |.vblCoun|t=1;....|
|00002f10| 09 09 09 09 2f 2f 20 72 | 65 2d 65 6e 61 62 6c 65 |....// r|e-enable|
|00002f20| 20 69 6e 74 65 72 72 75 | 70 74 0d 09 53 74 61 72 | interru|pt..Star|
|00002f30| 74 54 69 6d 65 72 28 76 | 62 6c 44 61 74 61 2d 3e |tTimer(v|blData->|
|00002f40| 66 72 61 6d 65 54 69 6d | 65 72 29 3b 0d 7d 0d 0d |frameTim|er);.}..|
|00002f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f80| 00 00 01 00 00 00 01 9a | 00 00 00 9a 00 00 00 46 |........|.......F|
|00002f90| 00 00 02 13 1c 42 4e 6f | 6e 2d 43 6f 6c 6c 65 67 |.....BNo|n-Colleg|
|00002fa0| 65 20 57 6f 72 6b 20 53 | 74 75 64 79 20 4a 6f 62 |e Work S|tudy Job|
|00002fb0| 0c 56 42 4c 49 6e 73 74 | 61 6c 6c 2e 63 74 02 00 |.VBLInst|all.ct..|
|00002fc0| 00 00 54 45 58 54 4b 41 | 48 4c 00 00 00 00 00 00 |..TEXTKA|HL......|
|00002fd0| 00 00 54 45 58 54 4b 41 | 48 4c 00 00 00 00 00 00 |..TEXTKA|HL......|
|00002fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ff0| 00 00 a7 e5 d5 d3 00 00 | 00 00 00 00 01 e0 00 01 |........|........|
|00003000| 00 00 00 00 00 00 00 00 | 48 57 00 00 00 00 00 00 |........|HW......|
|00003010| 00 00 00 00 00 00 00 00 | 0b 00 00 00 02 13 05 42 |........|.......B|
|00003020| 4e 6f 6e 65 02 00 00 00 | 4d 41 49 4c 43 45 44 41 |None....|MAILCEDA|
|00003030| 00 00 00 00 00 00 00 00 | 00 00 02 3d 00 00 00 00 |........|...=....|
|00003040| 09 84 00 00 10 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003050| a3 52 0b f4 a3 52 0b f4 | 00 00 00 00 00 00 00 00 |.R...R..|........|
|00003060| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 48 55 |........|......HU|
|00003070| 00 02 00 00 00 00 00 00 | 00 00 48 55 00 00 00 00 |........|..HU....|
|00003080| 00 00 00 88 00 04 00 24 | 00 00 22 71 00 ad 00 50 |.......$|.."q...P|
|00003090| 42 b4 00 00 15 73 6c 6f | 74 52 6f 75 74 69 6e 65 |B....slo|tRoutine|
|000030a0| 73 41 76 61 69 6c 61 62 | 6c 65 00 24 00 00 22 71 |sAvailab|le.$.."q|
|000030b0| 00 ad 00 50 42 a4 00 00 | 15 73 6c 6f 74 52 6f 75 |...PB...|.slotRou|
|000030c0| 74 69 6e 65 73 41 76 61 | 69 6c 61 62 6c 65 00 28 |tinesAva|ilable.(|
|000030d0| 00 00 25 c7 00 c6 00 50 | 42 94 80 00 00 47 01 4d |..%....P|B....G.M|
|000030e0| 01 1c 02 7c 94 20 00 00 | 00 00 00 00 09 2a 76 62 |...|. ..|.....*vb|
|000030f0| 6c 44 61 74 61 20 00 16 | 00 00 25 c7 00 c6 00 50 |lData ..|..%....P|
|00003100| 42 14 00 00 07 76 62 6c | 44 61 74 61 00 00 00 0a |B....vbl|Data....|
|00003110| 00 00 29 77 00 e7 00 00 | 00 00 00 00 01 00 00 00 |..)w....|........|
|00003120| 01 9a 00 00 00 9a 00 00 | 00 46 01 0f e7 ec 1c 48 |........|.F.....H|
|00003130| 00 00 00 1c 00 46 00 01 | 44 54 56 55 00 00 00 12 |.....F..|DTVU....|
|00003140| 42 4b 50 54 00 00 00 1e | 4e 26 ff ff 00 00 00 00 |BKPT....|N&......|
|00003150| 00 00 00 00 5b 2d ff ff | 00 00 00 8c 00 00 00 00 |....[-..|........|
|00003160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+